LaTeX forum ⇒ XeTeXHow to globally assign fonts to elements of a given type, and to environments

Information and discussion about XeTeX, an alternative for pdfTeX based on e-Tex
Posts: 4
Joined: Sat Jun 03, 2017 4:26 pm

How to globally assign fonts to elements of a given type, and to environments

Postby crl » Sun Jan 21, 2018 6:54 pm

I'm thinking of moving from pdfLaTeX to XeLaTeX or LuaLaTex, and have read the users' part of the fontspec document and done a web search.

Possibly I've missed something, but couldn't find information or examples on how to assign, in the preamble, a font or a font family to all elements in a document of a given type, for example section names (titles), table contents or environments. To illustrate, I'd like to to use a sans serif font different from the main one for the chapter titles of a book.


User avatar
Stefan Kottwitz
Site Admin
Posts: 9604
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Jan 21, 2018 8:02 pm

That's independent of the engine (XeLaTeX or pdfLaTeX or LuaLaTeX). It's a style thing, so it depends on style files (.sty, packages) or the document class. Which one do you use? Modern classes, such as KOMA-Script classes, provide exactly this what you are looking for.

Stefan admin

Posts: 4
Joined: Sat Jun 03, 2017 4:26 pm

Postby crl » Sun Jan 21, 2018 11:27 pm

Thanks for your reply. Up till now I've used only the standard book and article classes (book for self-editing a friend's novels, article for scientific writing). In reaction to historical misuse of computing power, these deliberately encourage users to use only one font. KOMA-Script is new to me. There is a lot to read in the manual, but it answers my question, while giving sound advice on the legitimate use of a second font for headings. Modern fonts like Lato have many variants that should help even an amateur in obtaining a good balance.

On a related front, I've been rather ineptly trying to influence the approach of LibreOffice Writer to styles and immediate formatting ( ... i?id=90068). Recent developments in the LaTeX ecosystem might guide a much-needed modernisation of LO if the respective experts would indulge in a bit of cross-fertilisation. I think the most urgent priority here is to get each element of Writer that has a style (headings...) to scale automatically to the text body point size. This seems obvious to LaTeX users, but not, apparently, to the wierd world of wordprocessors.

Return to “XeTeX”

Who is online

Users browsing this forum: No registered users and 0 guests