LaTeX template: Simplify fontspec usage (#5218)
Simplify the approach of #5212, ensuring that `mainfont` is used as the base font for scaling and that LuaLaTeX does not display the mono font with TeX ligatures (as it does not use the `Mapping=tex-ansi` option). With a modified version of `\defaultfontfeatures`, fontspec will continue to report scaling against the old default font in the log, but it nonetheless displays main font at the specified size. Using this rather than setting `Scale=MatchLowercase` for each family individually means that users will not lose scaling when upgrading to the new template if they were using other font options. Scaling can be disabled for an individual family by adding the option `Scale=1` to `sansfontoptions`, `monofontoptions`, etc. Remove the `\setromanfont` command added in #4665, as this is not documented in the fontspec manual and appears to be a deprecated alias for `\setmainfont`. For the release notes, I should also add that one can imitate the previous appearance with `-V mainfontoptions="Scale=MatchLowercase"`.
This commit is contained in:
parent
fd222b811b
commit
96892ea8d7
6 changed files with 19 additions and 13 deletions
|
@ -1527,13 +1527,12 @@ LaTeX variables are used when [creating a PDF].
|
|||
`fontfamily` set to [`mathpazo`] provides Palatino with old-style
|
||||
figures and true small caps; may be repeated for multiple options
|
||||
|
||||
`mainfont`, `romanfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
|
||||
`mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
|
||||
: font families for use with `xelatex` or
|
||||
`lualatex`: take the name of any system font, using the
|
||||
[`fontspec`] package. Note that if `CJKmainfont` is used,
|
||||
the [`xecjk`] package must be available.
|
||||
[`fontspec`] package. `CJKmainfont` uses the [`xecjk`] package.
|
||||
|
||||
`mainfontoptions`, `romanfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
|
||||
`mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
|
||||
: options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
|
||||
`CJKmainfont` in `xelatex` and `lualatex`. Allow for any choices
|
||||
available through [`fontspec`], such as the OpenType features
|
||||
|
|
|
@ -110,30 +110,29 @@ $if(mathspec)$
|
|||
$else$
|
||||
\usepackage{unicode-math}
|
||||
$endif$
|
||||
\defaultfontfeatures{Scale=MatchLowercase}
|
||||
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
|
||||
$if(mainfont)$
|
||||
\setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
|
||||
$endif$
|
||||
$if(romanfont)$
|
||||
\setromanfont[$if(romanfontoptions)$$for(romanfontoptions)$$romanfontoptions$$sep$,$endfor$$else$Scale=MatchLowercase$endif$]{$romanfont$}
|
||||
$endif$
|
||||
$if(sansfont)$
|
||||
\setsansfont[$if(sansfontoptions)$$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$$else$Scale=MatchLowercase$endif$]{$sansfont$}
|
||||
\setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
|
||||
$endif$
|
||||
$if(monofont)$
|
||||
\setmonofont[$if(monofontoptions)$$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$else$Scale=MatchLowercase$endif$]{$monofont$}
|
||||
\setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$}
|
||||
$endif$
|
||||
$for(fontfamilies)$
|
||||
\newfontfamily{$fontfamilies.name$}[$if(fontfamilies.options)$$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$$else$Scale=MatchLowercase$endif$]{$fontfamilies.font$}
|
||||
\newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
|
||||
$endfor$
|
||||
$if(mathfont)$
|
||||
$if(mathspec)$
|
||||
\ifxetex
|
||||
\setmathfont(Digits,Latin,Greek)[$if(mathfontoptions)$$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$$else$Scale=MatchLowercase$endif$]{$mathfont$}
|
||||
\setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
|
||||
\else
|
||||
\setmathfont[$if(mathfontoptions)$$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$$else$Scale=MatchLowercase$endif$]{$mathfont$}
|
||||
\setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
|
||||
\fi
|
||||
$else$
|
||||
\setmathfont[$if(mathfontoptions)$$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$$else$Scale=MatchLowercase$endif$]{$mathfont$}
|
||||
\setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
|
||||
$endif$
|
||||
$endif$
|
||||
$if(CJKmainfont)$
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
\usepackage{textcomp} % provides euro and other symbols
|
||||
\else % if luatex or xelatex
|
||||
\usepackage{unicode-math}
|
||||
\defaultfontfeatures{Scale=MatchLowercase}
|
||||
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
|
||||
\fi
|
||||
% use upquote if available, for straight quotes in verbatim environments
|
||||
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
\usepackage{textcomp} % provides euro and other symbols
|
||||
\else % if luatex or xelatex
|
||||
\usepackage{unicode-math}
|
||||
\defaultfontfeatures{Scale=MatchLowercase}
|
||||
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
|
||||
\fi
|
||||
% use upquote if available, for straight quotes in verbatim environments
|
||||
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
\usepackage{textcomp} % provides euro and other symbols
|
||||
\else % if luatex or xelatex
|
||||
\usepackage{unicode-math}
|
||||
\defaultfontfeatures{Scale=MatchLowercase}
|
||||
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
|
||||
\fi
|
||||
% use upquote if available, for straight quotes in verbatim environments
|
||||
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
\usepackage{textcomp} % provides euro and other symbols
|
||||
\else % if luatex or xelatex
|
||||
\usepackage{unicode-math}
|
||||
\defaultfontfeatures{Scale=MatchLowercase}
|
||||
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
|
||||
\fi
|
||||
% use upquote if available, for straight quotes in verbatim environments
|
||||
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
|
||||
|
|
Loading…
Add table
Reference in a new issue