[Tex/LaTex] Fine-tune styles and fonts

fontspdftex

I'm using the Fourier package to set the fonts in my document, but I'm not very happy with the settings it employs:

enter image description here

As I later found out, the sans-serif font above is the Computer Modern Sans—that is, the "default" cmss font-family; the Fourier package doesn't change it.

The caligraphy font above is from the Fourier package. The accepted answer focus on how to change font families and explains how the Fourier font works. The answer to the caligraphy font was given in the comments by @marsupilam.

Specifically, I don't like that the l is too thin and the caligraphy text is too fancy.

After reading a little bit of the LaTeX/Fonts Wikibooks page and with the help of The LaTeX Font Catalogue, I managed to change the style of \textsf. Here I used the Chivo font, just to try it out:

enter image description here

The code for this is rather simple:

\documentclass{article}

\usepackage{Chivo}
\usepackage{fourier}

\begin{document}
Quidquid latine dictum sit, altum videtur. (font-family: Utopia)

\textsf{Quidquid latine dictum sit, altum videtur. (font-family: Chivo)}

$\mathcal{T R S}$ (font-family: ?)
\end{document}

It "kind of works". The problem with this is that the "width" and "height" of the sans-serif text is not matching those of the serif:

enter image description here

The answer to that is also in the comments, given by @AndrewSwann.

I have also been wondering whether I could use two serif typefaces in the same document. This would be purely for aesthetic purposes.

So I tried this:

\documentclass{article}

\usepackage{fourier}
\usepackage{newcent}
\usepackage{Chivo}

\begin{document}
Quidquid latine dictum sit, altum videtur. (font-family: New Century)

{\fontfamily{put}\selectfont Quidquid latine dictum sit, altum videtur. (font-family: Utopia)}

\textsf{Quidquid latine dictum sit, altum videtur. (font-family: Chivo)}
\end{document}

And, again, this "kind of works". However, the fonts/typefaces that will be used are highly dependent on the order I include the packages in the preamble—which strongly indicates that I'm doing it wrong.

Also, even though the "widths" and "heights" of the fonts seem to match better, the Utopia-text with \selectfont renders bigger than when not using \selectfont.

enter image description here

So here are my questions:

  1. How can I use two or more serif typefaces in the same document? (Or two or more sans-serif, etc)
  2. How can I change the size of the font so that \textsf{} from the Chivo package will look compatible with the standard font-family from the fourier package?
  3. How can I change the caligraphy font? I like how \mathcal looks when I don't use any font package, but the font provided by fourier is unacceptable to me.
  4. Did I properly use the terms "font-family" and "typeface" in my question? What font does \usepackage{fourier} specify to \textsf when no other font command is used?

I have read that LuaTeX has very neat commands to select fonts. This is what I'm looking for. But I'm with a 120-pages document right now and I don't know anything about LuaTeX, so migrating seems a bad idea.

Best Answer

The low level font selection commands are best avoided in documents when possible. For a one-off special effect, where you just want something special for a title or something, they are satisfactory. For anything else, they should be avoided.

Let's see what

\documentclass{article}
\usepackage{fourier}
\begin{document}
This text has the expected size.

\fontfamily{futs}\selectfont This text has the expected size.

{\fontfamily{put}\selectfont This text has not the expected size.}
\end{document}

actually does on the console:

(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo))

This sets up the point sizes for a default 10pt font.

(/usr/local/texlive/2016/texmf-dist/tex/latex/fourier/fourier.sty

Setting aside what fourier does for a minute, it loads some additional things:

(/usr/local/texlive/2016/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/t1enc.def))
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/textcomp.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/ts1enc.def))

Output uses T1 font encoding. The TS1 encoding is loaded to support text-mode symbols.

(/usr/local/texlive/2016/texmf-dist/tex/latex/fourier/fourier-orns.sty))

These are fourier embellishments and ornaments.

(./prawf.aux) (/usr/local/texlive/2016/texmf-dist/tex/latex/fourier/fmlfutm.fd)
(/usr/local/texlive/2016/texmf-dist/tex/latex/fourier/fmsfutm.fd)
(/usr/local/texlive/2016/texmf-dist/tex/latex/fourier/fmxfutm.fd)

These are font definitions for maths. They use non-standard encodings: FML, FMS and FMX, roughly equivalent to OML, OMS and OMX, which are standard maths encodings.

(/usr/local/texlive/2016/texmf-dist/tex/latex/base/ts1cmr.fd)

This is reading the font definitions for Computer Modern Roman's text symbol (TS1) encoding.

(/usr/local/texlive/2016/texmf-dist/tex/latex/fourier/t1futs.fd)

This reads the font definitions for futs in the T1 font encoding.

(/usr/local/texlive/2016/texmf-dist/tex/latex/psnfss/t1put.fd)

This reads the font definitions for put in the T1 font encoding. This is part of psnfss, so it is provided by the LaTeX support for the base postscript 35 fonts.

 [1{/usr/local/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]

This is the active main mapping file which pdfTeX uses to find the postscript fonts corresponding to the TeX fonts requested. The file tells pdfTeX something about which `.pfb` file to use and how to figure out where in the `.pfb` file a requested character's glyph can be found.

{/usr/local/texlive/2016/texmf-dist/fonts/enc/dvips/base/8r.enc}

This is a raw encoding for 8-bit fonts (with 256 slots). You don't use this encoding directly, but it is sometimes used as an intermediate encoding, to translate a standard postscript encoding.

</usr/local/texlive/2016/texmf-dist/fonts/type1/adobe/utopia/putr8a.pfb>

This is the actual PFB file used in the document: putr8a means that this is Adobe Utopia regular and that the file uses the Adobe 8-bit encoding. This doesn't contain enough information to use the font because it really only contains the pictures of the characters (glyphs). It doesn't contain information about how to combine them, for example. (Postscript type1 fonts are supplied in 2 parts: typically, a PFB file and an Adobe Font Metric (AFM) file.)

So why does TeX load put rather than futs? Let's look at the font definition file for futs, t1futs.fd:

%Filename: t1futs.fd
%Created by: tex build-fourier
%Created using fontinst v1.926

%THIS FILE SHOULD BE PUT IN A TEX INPUTS DIRECTORY

\ProvidesFile{t1futs.fd}
   [2004/03/02 Fontinst v1.926 font definitions for T1/futs.]

\DeclareFontFamily{T1}{futs}{\providecommand {\SetFourierSpace }{}}

%Filename: t1futs.fd
%Created by: tex build-fourier
%Created using fontinst v1.926

%THIS FILE SHOULD BE PUT IN A TEX INPUTS DIRECTORY

\ProvidesFile{t1futs.fd}
   [2004/03/02 Fontinst v1.926 font definitions for T1/futs.]

\DeclareFontFamily{T1}{futs}{\providecommand {\SetFourierSpace }{}}

\DeclareFontShape{T1}{futs}{m}{n}{% medium upright
   <-> futr8t
}{\SetFourierSpace}

\DeclareFontShape{T1}{futs}{m}{it}{% medium italic
   <-> futri8t
}{\SetFourierSpace}

\DeclareFontShape{T1}{futs}{b}{n}{% bold upright
   <-> futb8t
}{\SetFourierSpace}

\DeclareFontShape{T1}{futs}{b}{it}{% bold italic
   <-> futbi8t
}{\SetFourierSpace}

\DeclareFontShape{T1}{futs}{m}{sc}{% medium small-caps
   <-> futrc8t
}{\SetFourierSpace}

\DeclareFontShape{T1}{futs}{b}{sc}{% bold small-caps
   <-> futbc8t
}{\SetFourierSpace}

\DeclareFontShape{T1}{futs}{m}{sl}{% medium oblique
   <-> futro8t
}{\SetFourierSpace}

\DeclareFontShape{T1}{futs}{b}{sl}{% bold oblique
   <-> futbo8t
}{\SetFourierSpace}

% silent font substitutions which substitute bold for bold extended when the latter is requested, without issuing a warning

\DeclareFontShape{T1}{futs}{bx}{n}{<->ssub * futs/b/n}{}
\DeclareFontShape{T1}{futs}{bx}{it}{<->ssub * futs/b/it}{}
\DeclareFontShape{T1}{futs}{bx}{sc}{<->ssub * futs/b/sc}{}
\DeclareFontShape{T1}{futs}{bx}{sl}{<->ssub * futs/b/sl}{}

\endinput

So suppose we ask for futs medium upright in the T1 encoding. Then LaTeX will look for futr8t. 8t designates the T1 encoding. More specifically, it will load futr8t.tfm which is a TeX Font Metric file. (AFM files get combined with further information to create TFMs when font packages are created.)

Because this is pdfTeX and not TeX, pdfTeX will also look for information about where to find the glyphs etc. However, no entry for futr8t is to be found in the mapping file.

We do, however, find the line

futr8r Utopia-Regular "TeXBase1Encoding ReEncodeFont " <8r.enc <putr8a.pfb

So how do we get from futr8t to futr8r? The answer lies in the fact that fourier provides virtual fonts. In this case, the virtual font is futr8t.vf. Virtual fonts are useful because they allow you to combine glyphs from different fonts into a single TeX font, construct certain missing glyphs and do some more dubious things, such as fake oblique and small-caps.

However, virtual fonts don't contain any glyphs. Rather the virtual font refers to one or more further fonts, which eventually have to refer to something in the mapping file pointing to an actual PFB or similar. In this case, the virtual font must eventually point to the TeX font futr8r which has both a TFM file, futr8r.tfm and a line in the mapping file referencing putr8a.pfb.

So if putr was not available on your system, you could not possibly use futr with pdfTeX. (You could potentially use it with TeX, but you would not be able to view the result except as a series of boxes, because the DVI viewer would need the glyphs to render the document meaningfully.)

OK. Enough background. How can we set things up to use multiple fonts in a document, desirous as we are of spawning a typographical monstrosity?

Note that I am NOT recommending this. I merely demonstrate the technical possibility.

In general, the use of multiple fonts is not wise. In particular, mixing more than one serif or more than one sans is not recommended unless you really know what you are doing.

Caveat emptor.

However, if you are bent on doing something you shouldn't, you might as well do it right.

Here, I use Venturis ADF for the default serif and sans, setting up macros to switch to Utopia when desired. But do note Bernard's comments concerning erewhon. Fake small-caps are really not satisfactory. (I avoid them in the example below.) There is absolutely no excuse for using them when genuine small-caps are available.

\documentclass{article}
\usepackage{venturis}
\DeclareRobustCommand\futsie{%
  \fontencoding{T1}%
  \fontfamily{futs}%
%   \fontseries{m}% uncomment if you don't want the command to fail due to an unavailable width/weight and don't mind being bumped back to medium
%   \fontshape{n}% uncomment if you don't want the command to fail due to an unavailable shape and don't mind being bumped back to upright
  \selectfont
}
\DeclareTextFontCommand\textfut{\futsie}

\begin{document}
{%
  \Large\textvt{Don't Try This At Home, Kids!}\par
}

This is in the default serif font.

\textsf{This is a little bit in the default sans.}

More default serif here.

\futsie This changes to the requested font indefinitely.

\sffamily This changes to the default sans indefinitely.

\normalfont This gets back to the default serif indefinitely.

\textfut{Just a bit in the alternative} and back to the default.

{%
  \Large\textvtl{Create Your Very Own Typographical Monster!}\par
}

\end{document}

home-grown monster

EDIT

The differences between Fourier, as a whole, and Adobe Utopia are quite extensive. Both sets of fonts rely on faked small-caps and neither loads the postscript fonts directly. Both rely on virtual fonts.

However, Fourier provides additional type1 fonts, which supplement those provided by Utopia. A virtual font such as those in the futs family uses glyphs from a number of different postscript fonts, in addition to fake glyphs based on them.

Here's the AFM for one of the postscript fonts provided by Fourier itself.

StartFontMetrics 2.0
Comment Panose 2 0 0 0 0 0 0 0 0 0
FullName Fourier-Alternate-Roman
FontName Fourier-Alternate-Roman
FamilyName Fourier-Alternate-Roman
Weight Regular
Notice (C) 2003, GUTenberg
Version 001.004
IsFixedPitch false
ItalicAngle 0.00
FontBBox -33 -242 712 705
Ascender 742
Descender -230
XHeight 490
CapHeight 693
UnderlinePosition -100
UnderlineThickness 50
StdHW 35
StdVW 94
EncodingScheme FontSpecific
StartCharMetrics 11
C 32 ; WX 500 ; N space ; B 0 0 0 0 ;
C 33 ; WX 287 ; N dotlessj ; B -33 -242 200 502 ;
C 34 ; WX 501 ; N euro ; B 22 -13 459 705 ;
C 35 ; WX 584 ; N eng ; B 32 -242 529 502 ;
C 36 ; WX 713 ; N Eng ; B 34 -140 669 705 ;
C 37 ; WX 364 ; N perthousandzero ; B 0 -12 315 354 ;
C 38 ; WX 558 ; N mu ; B 40 -242 550 502 ;
C 39 ; WX 593 ; N Engsmall ; B 6 -99 555 515 ;
C 40 ; WX 767 ; N euro2 ; B 0 -12 712 705 ;
C -1 ; WX 0 ; N .null ; B 0 0 0 0 ;
C -1 ; WX 500 ; N CR ; B 0 0 0 0 ;
EndCharMetrics
EndFontMetrics

The first thing to notice about this file is that it is remarkably short. A standard TeX font has 128 or 256 slots for characters. This font only provides a handful.

The second thing to notice is that the characters provided are an odd bunch. There are no letters, for example, even though the font is described bed as 'Roman'.

What is significant about the characters listed is that they are all included in the T1 font encoding, none are included in Adobe Utopia and none can be effectively faked by construction from other characters. That is, these are designed to supplement what Utopia provides.

What futr8t does is to combine characters from Adobe Utopia regular upright and from Fourier Alternate Roman regular upright into a single TeX font. This can only be done, in the traditional TeX world, using virtual fonts. This is important because it does not require editing Adobe Utopia, which is probably prohibited by the licence.

The Fourier package also provides maths fonts to complement Utopia, text symbols and ornaments and various other things, including Greek for mathematics.

This has nothing to do with size. Utopia is provided in a single size. It can be scaled, as when you request it in a non-default size, but you don't need the sophistication of virtual fonts for that. (Just as well, or we'd all have to stick to 10pt, I think. Nothing else would be even remotely sane.)