Org: LaTeX, add a bunch of typeface presents
This commit is contained in:
parent
07c86da012
commit
37377ffd71
85
config.org
85
config.org
|
@ -7353,7 +7353,8 @@ introduce an =:order= keyword. Using this I'll arrange snippets as follows.
|
||||||
+ =0= Typography
|
+ =0= Typography
|
||||||
- =0= Fonts themselves
|
- =0= Fonts themselves
|
||||||
- =0.1= Typographic tweaks (=microtype=)
|
- =0.1= Typographic tweaks (=microtype=)
|
||||||
- =0.2= Extra maths
|
- =0.2= Maths setup
|
||||||
|
- =0.3= Maths font
|
||||||
- =0.4= Extra text shaping (~\acr~)
|
- =0.4= Extra text shaping (~\acr~)
|
||||||
- =0.5-0.9= Miscellaneous text modifications, trying to put shorter snippets first
|
- =0.5-0.9= Miscellaneous text modifications, trying to put shorter snippets first
|
||||||
+ =1= (/default/)
|
+ =1= (/default/)
|
||||||
|
@ -7597,7 +7598,7 @@ the cars in `org-latex-fontsets'."
|
||||||
"")
|
"")
|
||||||
(when (memq (cdr fontset-spec) desired-styles)
|
(when (memq (cdr fontset-spec) desired-styles)
|
||||||
(pcase (cdr fontset-spec)
|
(pcase (cdr fontset-spec)
|
||||||
(:serif nil)
|
(:serif "\\renewcommand{\\familydefault}{\\rmdefault}\n")
|
||||||
(:sans "\\renewcommand{\\familydefault}{\\sfdefault}\n")
|
(:sans "\\renewcommand{\\familydefault}{\\sfdefault}\n")
|
||||||
(:mono "\\renewcommand{\\familydefault}{\\ttdefault}\n"))))
|
(:mono "\\renewcommand{\\familydefault}{\\ttdefault}\n"))))
|
||||||
(error "Font-set %s is not provided in org-latex-fontsets" (car fontset-spec)))))
|
(error "Font-set %s is not provided in org-latex-fontsets" (car fontset-spec)))))
|
||||||
|
@ -7609,7 +7610,7 @@ preamble generation.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(add-to-list 'org-latex-conditional-features '(org-latex-default-fontset . custom-font) t)
|
(add-to-list 'org-latex-conditional-features '(org-latex-default-fontset . custom-font) t)
|
||||||
(add-to-list 'org-latex-feature-implementations '(custom-font :snippet (org-latex-fontset :serif :sans :mono) :order 0) t)
|
(add-to-list 'org-latex-feature-implementations '(custom-font :snippet (org-latex-fontset :serif :sans :mono) :order 0) t)
|
||||||
(add-to-list 'org-latex-feature-implementations '(.custom-maths-font :eager t :when (custom-font maths) :snippet (org-latex-fontset :maths) :order 0.1) t)
|
(add-to-list 'org-latex-feature-implementations '(.custom-maths-font :eager t :when (custom-font maths) :snippet (org-latex-fontset :maths) :order 0.3) t)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Finally, we just need to add some fonts.
|
Finally, we just need to add some fonts.
|
||||||
|
@ -7617,23 +7618,46 @@ Finally, we just need to add some fonts.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defvar org-latex-fontsets
|
(defvar org-latex-fontsets
|
||||||
'((cm nil) ; computer modern
|
'((cm nil) ; computer modern
|
||||||
(ibm
|
(alegreya
|
||||||
:serif "\\usepackage{plex-serif}"
|
:serif "\\usepackage[osf]{Alegreya}"
|
||||||
:sans "\\usepackage{plex-sans}"
|
:sans "\\usepackage{AlegreyaSans}"
|
||||||
:mono "\\usepackage{plex-mono}"
|
:mono "\\usepackage[scale=0.88]{sourcecodepro}"
|
||||||
:maths "% maths TBD")
|
:maths "\\usepackage[varbb]{newpxmath}")
|
||||||
|
(biolinum
|
||||||
|
:serif "\\usepackage[osf]{libertineRoman}"
|
||||||
|
:sans "\\usepackage[sfdefault,osf]{biolinum}"
|
||||||
|
:mono "\\usepackage[scale=0.88]{sourcecodepro}"
|
||||||
|
:maths "\\usepackage[libertine,varvw]{newtxmath}")
|
||||||
|
(fira
|
||||||
|
:sans "\\usepackage[sfdefault,scale=0.85]{FiraSans}"
|
||||||
|
:mono "\\usepackage[scale=0.80]{FiraMono}"
|
||||||
|
:maths "\\usepackage{newtxsf} % change to firamath in future?")
|
||||||
|
(kp
|
||||||
|
:serif "\\usepackage{kpfonts}")
|
||||||
(newpx
|
(newpx
|
||||||
:serif "\\usepackage{newpxtext}"
|
:serif "\\usepackage{newpxtext}"
|
||||||
:sans "\\usepackage{gillius}"
|
:sans "\\usepackage{gillius}"
|
||||||
:mono "\\usepackage[scale=0.9]{sourcecodepro}"
|
:mono "\\usepackage[scale=0.9]{sourcecodepro}"
|
||||||
:maths "\\usepackage[varbb]{newpxmath}")
|
:maths "\\usepackage[varbb]{newpxmath}")
|
||||||
(kp
|
(noto
|
||||||
:serif "\\usepackage{kpfonts}")
|
:serif "\\usepackage[osf]{noto-serif}"
|
||||||
(alegreya
|
:sans "\\usepackage[osf]{noto-sans}"
|
||||||
:serif "\\usepackage[osf]{Alegreya}"
|
:mono "\\usepackage[scale=0.96]{noto-mono}"
|
||||||
:sans "\\usepackage{AlegreyaSans}"
|
;; Wait till TeXlive 2021 is released, use notomath
|
||||||
:mono "\\usepackage[scale=0.88]{sourcecodepro}"
|
:maths "\\usepackage{newtxmath}")
|
||||||
:maths "\\usepackage[varbb]{newpxmath}"))
|
(plex
|
||||||
|
:serif "\\usepackage{plex-serif}"
|
||||||
|
:sans "\\usepackage{plex-sans}"
|
||||||
|
:mono "\\usepackage[scale=0.95]{plex-mono}"
|
||||||
|
:maths "\\usepackage{newtxmath}") ; may be plex-based in future
|
||||||
|
(source
|
||||||
|
:serif "\\usepackage[osf]{sourceserifpro}"
|
||||||
|
:sans "\\usepackage[osf]{sourcesanspro}"
|
||||||
|
:mono "\\usepackage[scale=0.95]{sourcecodepro}"
|
||||||
|
:maths "\\usepackage{newtxmath}") ; may be sourceserifpro-based in future
|
||||||
|
(times
|
||||||
|
:serif "\\usepackage{newtxtext}"
|
||||||
|
:maths "\\usepackage{newtxmath}"))
|
||||||
"Alist of fontset specifications.
|
"Alist of fontset specifications.
|
||||||
Each car is the name of the fontset (which cannot include \"-\").
|
Each car is the name of the fontset (which cannot include \"-\").
|
||||||
|
|
||||||
|
@ -8327,10 +8351,9 @@ locally binding ~auto-mode-alist~ to ~nil~.
|
||||||
|
|
||||||
For how I've setup Org's LaTeX export, the following packages are needed:
|
For how I've setup Org's LaTeX export, the following packages are needed:
|
||||||
#+name: org-latex-required-packages-list
|
#+name: org-latex-required-packages-list
|
||||||
+ Alegreya
|
|
||||||
+ adjustbox
|
+ adjustbox
|
||||||
+ amsmath
|
|
||||||
+ arev
|
+ arev
|
||||||
|
+ amsmath
|
||||||
+ booktabs
|
+ booktabs
|
||||||
+ cancel
|
+ cancel
|
||||||
+ capt-of
|
+ capt-of
|
||||||
|
@ -8345,27 +8368,47 @@ For how I've setup Org's LaTeX export, the following packages are needed:
|
||||||
+ mathalpha
|
+ mathalpha
|
||||||
+ mathtools
|
+ mathtools
|
||||||
+ microtype
|
+ microtype
|
||||||
+ newpxmath
|
|
||||||
+ pdfx
|
+ pdfx
|
||||||
+ pifont
|
+ pifont
|
||||||
+ preview
|
+ preview
|
||||||
+ siunitx
|
+ siunitx
|
||||||
+ soul
|
+ soul
|
||||||
+ sourcecodepro
|
|
||||||
+ subcaption
|
+ subcaption
|
||||||
+ svg
|
+ svg
|
||||||
+ tcolorbox
|
+ tcolorbox
|
||||||
+ xcolor
|
+ xcolor
|
||||||
+ xparse
|
+ xparse
|
||||||
|
|
||||||
|
Then for the various fontsets:
|
||||||
|
#+name: org-latex-font-packages-list
|
||||||
|
+ Alegreya
|
||||||
|
+ biolinum
|
||||||
|
+ FiraMono
|
||||||
|
+ FiraSans
|
||||||
|
+ kpfonts
|
||||||
|
+ libertine
|
||||||
|
+ newpxmath
|
||||||
|
+ newpxtext
|
||||||
|
+ newtxmath
|
||||||
|
+ newtxtext
|
||||||
|
+ newtxsf
|
||||||
|
+ noto
|
||||||
|
+ plex-mono
|
||||||
|
+ plex-sans
|
||||||
|
+ plex-serif
|
||||||
|
+ sourcecodepro
|
||||||
|
+ sourcesanspro
|
||||||
|
+ sourceserifpro
|
||||||
|
|
||||||
We can write a function which will check for each of these packages with
|
We can write a function which will check for each of these packages with
|
||||||
=kpsewhich=, and then if any of them are missing we'll inject some advice into the
|
=kpsewhich=, and then if any of them are missing we'll inject some advice into the
|
||||||
generated config that gets a list of missing packages and warns us every time we
|
generated config that gets a list of missing packages and warns us every time we
|
||||||
export to a PDF.
|
export to a PDF.
|
||||||
|
|
||||||
#+name: org-missing-latex-packages
|
#+name: org-missing-latex-packages
|
||||||
#+begin_src emacs-lisp :noweb-ref none :var org-latex-required-packages-list=org-latex-required-packages-list
|
#+begin_src emacs-lisp :noweb-ref none :var org-latex-required-packages-list=org-latex-required-packages-list :var org-latex-font-packages-list=org-latex-font-packages-list
|
||||||
(setq org-required-latex-packages (mapcar #'car org-latex-required-packages-list))
|
(setq org-required-latex-packages (append (mapcar #'car org-latex-required-packages-list)
|
||||||
|
(mapcar #'car org-latex-font-packages-list)))
|
||||||
|
|
||||||
(defun check-for-latex-packages (packages)
|
(defun check-for-latex-packages (packages)
|
||||||
(delq nil (mapcar (lambda (package)
|
(delq nil (mapcar (lambda (package)
|
||||||
|
|
Loading…
Reference in a new issue