I am now switching over to lualatex (hence so many questions), partly in order to be able to use another font, partly to learn lua facilities.
\usepackage{fontspec} %% should come before microtype
\newfontfamily{\andika}
[Ligatures=TeX, % recommended
UprightFont={*},
ItalicFont={* Italic},
BoldFont={* Bold},
BoldItalicFont={* Bold Italic}]{Andika}
\newcommand{\textandikabf}[2][20]{{\andika\bfseries\fontsize{#1}{#1}\selectfont#2}}
Like most people, I have hamstered together style files I have used for years, which include fonts I have used for years, most of which I don't fully understand. I believe fontspec tinkers/overrides some of them. I am trying to figure out what is good practice now.
\usepackage[T1]{fontenc}
— presumably, I still leave this.
\usepackage{charter}
— was my main font because it is heavier than modern roman, has good math fonts, and is free whereever latex is installed. alas, fontspec seems to override this one, even though I do not use \setmainfont
. I am also not sure whether the macos (or other computer system) charter fonts are as good as those included with texlive.
\usepackage[mdbch,ttscaled=true]{mathdesign}
— to match the charter on the math font side.
\usepackage{textcomp}
— text companion fonts, presumably also still ok. For stuff like the Yen symbol.
\usepackage{microtype}
— I believe this has to be loaded after package fontspec.
Ergo, my primary question is how to get back my good latex-native charter font now (and still use andika for highlights). My secondary question is how to deal with these other mentioned font-related packages. Advice [as always] highly appreciated.
PS: (If anyone knows of another good universal and free font on all TeX systems with good math support that would be better for a textbook, feel free to drop me a hint, too. The font catalog lists fonts with mathsupport in https://tug.org/FontCatalogue/mathfonts.html .)
Best Answer
You would not use
fontenc
together withfontspec
. It’s mostly harmless, but it won’t work. Thefontspec
package switches from 8-bit legacy encodings to Unicode. It is still possible to mix and match if you really want to. You also do not need to loadtextcomp
, with or withoutfontspec
. It’s now part of the LaTeX kernel.What you actually want to do is load a TrueType or OpenType version of Charter, together with your math font. There are several clones in the TeX Live distribution, including XCharter.
This uses Math Design Charter as the math font and the OTF version of XCharter as the text font. Since both were cloned from the same original font, they match.
There isn’t always an exact match for your text font in a TeX math package, though. When there isn’t, you can use your modern font for letters in math mode. You can set up
mathastext
,mathspec
orunicode-math
to do it. If all you need to do is set up the\mathnormal
alphabet to use the main text font in italic style, something like this works: