Text FormattingChoose fonts for document structure?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
karlisrepsons
Posts: 50
Joined: Sat May 23, 2009 10:13 pm

Choose fonts for document structure?

Post by karlisrepsons »

Hi all,
I was experimenting with fonts and some of their advanced features, but still have no clear idea of how to use them: how can particular font+features be chosen for \section text? For TOC? Page numbers? Bibliography?

For example, if I've set oldstyle numbers to be used by default, but don't want them to appear on \section texts or just TOC, inevitably they need to be set somehow specially.

Any links? Or, still better, is there some way for me to know where to find that out without much of search engine use?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Choose fonts for document structure?

Post by localghost »

karlisrepsons wrote:[…] For example, if I've set oldstyle numbers to be used by default, but don't want them to appear on \section texts or just TOC, inevitably they need to be set somehow specially. […]
Such font attributes are set globally and I'm not aware of a solution that would allow to switch from old style to normal numbers in the document. For the sake of consistency this is not recommendable.


Best regards
Thorsten
bdr
Posts: 4
Joined: Thu Dec 03, 2009 4:15 pm

Choose fonts for document structure?

Post by bdr »

If you're using XeLateX, you can get what you want by using the following packages:

Code: Select all

\usepackage{fontspec} % for using and definining fonts
\usepackage{titlesec} % to redefine title formatting
\usepackage{fancyhdr} % to redefine footers and headers

% font stuff
\defaultfontfeatures{Ligatures=Common,Mapping=tex-text}
\setmainfont[Numbers=OldStyle]{Warnock Pro}
\newfontfamily\mytitlefont[Numbers={Lining,SlashedZero}]{Warnock Pro}

% title stuff
\titleformat{\section}{\mytitlefont\Large}{\thesection}{.5em}{}

% footer stuff
\fancyfoot[LF]{\mytitlefont\footnotesize\thesection}
\fancyfoot[RF]{\mytitlefont\footnotesize\thepage}
Hope this helps. Read the documentation for fontspec, titlesec and fancyhdr for more info on their usage. I don't think it's a typographical error to use two different types of numbers; oldstyle numbers look great in running text, but not so great in titles and vice versa. (I use slashed zero because I have a few zero-numbered sections. I don't want any confusion with a capital letter `O'.)

Use titletoc to redefine toc formatting.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Choose fonts for document structure?

Post by localghost »

bdr wrote:[…] Read the documentation for fontspec, titlesec and fancyhdr for more info on their usage. I don't think it's a typographical error to use two different types of numbers; oldstyle numbers look great in running text, but not so great in titles and vice versa. […]
Headers and footers can also be customized with titlesec. So I would consider fancyhdr superfluous in this case. Unfortunately the font you suggested is commercial. If you have any solution with a free font I would be very interested in that.
bdr
Posts: 4
Joined: Thu Dec 03, 2009 4:15 pm

Choose fonts for document structure?

Post by bdr »

You're right, I use fancyhdr out of habit. Any OpenType font with oldstyle and lining numbers will do. I believe -- based upon a cursory glance with Apple's Font Book -- that most TeX Gyre fonts contain both sets.
karlisrepsons
Posts: 50
Joined: Sat May 23, 2009 10:13 pm

Re: Choose fonts for document structure?

Post by karlisrepsons »

About free fonts...
After some days of searches and experiments I've found quite some. These seemed good:

Tex Gyre:
Bonum: Hmmmm... Good!
Heros: good!!

Other:

SIL:
Gentium (GenAI102.TTF, GenAR102.TTF, GenI102.TTF, GenR102.TTF) are fine, but
basic are missing some characters.
CharisSIL, DoulosSIL - fine.

Linux Libertine: good.
Lavoisier: great!!
Lido STF: meant for newspaper, I liked; however, is not really a free font.
Cardo.

There is also a free font review in [1]. You can obtain some good free fonts through [2,3,4]. And thanks for formatting suggestions, I'll see later!

If ligatures, slashed zero and oldstyle numbers along with kerning is what you need, you might be very well off with Linux Libertine!

[1] http://www.garzo.co.uk/documents/freefonts.pdf
[2] http://scripts.sil.org/cms/scripts/page ... tDownloads
[3] http://linuxlibertine.sourceforge.net
[4] http://www.gust.org.pl/projects/e-foundry/tex-gyre
Post Reply