Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Neither of \sfseries nor \sfshape seem to work. So what is the command I'm looking for to change the current group to sans serif? \bfseries, \scshape and \itshape work, but I can't find the sans serif command to do the same thing...

share|improve this question
4  
See The LaTeX Wikibook for a full table. –  Caramdir Dec 23 '10 at 23:34
    
New link to the wikibook due to expansion there: en.wikibooks.org/wiki/LaTeX/Fonts –  Chris H Dec 24 '13 at 11:30
    
Short answer: \sffamily\mdseries selects the normal weight from sans-serif font. –  Tim S. Aug 25 at 20:29

2 Answers 2

up vote 42 down vote accepted

The command you want is \sffamily. I don't know why bold is a series (other font weights are too; it's probably a typographical term), but it should be clear why small caps and italics are shapes; sans-serif fonts are a family of fonts, hence the name. (While I understand the logic, it does feel like consistency would be nice….) There's a list in a TeX FAQ answer:

The default set of modal commands offers weights \mdseries and \bfseries, shapes \upshape, \itshape, \scshape and \slshape, and families \rmfamily, \sffamily and \ttfamily.

The commands, in order, activate medium weight, boldface, upright, italic, small caps, slanted, roman (serif), sans serif, and typewriter text (monospaced). To form the \textXX commands, the first two letters of the modal commands are always used.

share|improve this answer
1  
The microtype package also offers \lsstyle (and \textls) for letter-spaced text. –  lockstep Dec 23 '10 at 23:41
12  
I believe the idea is that the family, series, and shape are orthogonal axes. One should be able to specify a weight (what LaTeX calls the series) and shape for a given font family. (This is selecting a typeface. Once you have also selected a size, then you have selected a font. E.g., Times is a font family, Times Italic Bold is a typeface, and 12 pt Times Italic Bold is a font. Wikipedia gets this wrong in their example.) –  TH. Dec 23 '10 at 23:42
    
So you should be able to have bold sans serif small caps, but not bold italic small caps, becaus it and sc are both shapes? –  Seamus Dec 24 '10 at 11:47
    
@Seamus: As far as I understand it, yes. –  Antal S-Z Dec 24 '10 at 14:00
1  
For the reason why weights are named series, I believe that is a tradition. For example traditionally book weights are numbered as series 55, and bold is 65. For example the full name for Linotype Univers Roman is ... 55 Roman and the bold font is ... 65 Bold. –  Yan Zhou Aug 16 '11 at 14:03

Although this question is quite old (only found it because lockstep reactivated it) it’s maybe worth to add this information.

For my lectures on LaTeX I use the following image to explain the way LaTeX categorizes the different characteristics of printed material.

font categories

1. Encoding

The first thing to select is how the font is encoded in it’s file(s), that means which character is on which position. The font encoding (in pdflatex) is usually set with the fontenc package using something like

\usepackage[T1]{fontenc}

This has nothing to do with the appearance of single letters.

2a. Typeface and 2b. Family

Here LaTeX doens’t differentiate too much. The Typeface (2a) is the “font” like Computer Modern Roman, Times New Roman or Helvetica, for instance. The typeface is usually (in pdflatex) selected by loading a package like

\usepackge{lmodern}

to load the Latin Modern fonts (a list of many font packages can be found in The LaTeX Font Catalouge). And here the problem starts: lmodern will not only load a single typeface but three typefaces for the three families (2b) Roman/Serif, Sans Serif and Typewriter. To select a family (2b) you can use the following three font switches

\rmfamily and \textrm{<text>} % = Serif/Roman
\sffamily and \textsf{<text>} % = Sans Serif
\ttfamily and \texttt{<text>} % = Typewriter (Teletype)

family

3a. Series and 3b. Shape

On the next level you can select a series (3a, also known as weight) and/or a shape (3b). The different series share the same characteristics but differ in the stroke width. Normally LaTeX uses only two series but there are typefaces with up to ten or more different weights.

\mdseries and \textmd{<text>} % = normal
\bfseries and \textbf{<text>} % = bold face

series (serif family)

or

series (sans family)

for the sans serif family.

In general you can combine the series with any shapes, but not all typefaces contain all possible combinations, for example bold italic small caps are extremely rarely to find. It is possible to combine several shapes too but not two different series. In LaTeX you can select out of the following ones

\upshape and \textup{<text>} % = normal
\itshape and \textit{<text>} % = italic
\slshape and \textsl{<text>} % = slanted/oblique
\scshape and \textsc{<text>} % = small caps

shape (serif family)

Please note that italic and slanted are not the same in any case. Especially serif families normally (hopefully) have a real italic shape that even has different letter forms, e.g. the letter a. Sans serif families often level this difference as you can see in the following image.

shape (sans family)

I won’t show any theoretically possible combination since the Latin Modern typefaces don’t support all of them, as you can see the sans serif not even has a small caps shape. In this regard I’d like to highly recommend you not to fake small caps by using scaled uppercase letters. When you scale the uppercase letters you will also scale the stroke width and then the faked small caps won’t match with the upper case letters.

real vs. faked small caps

4. Size

Sure it is worth a discussion if the size should be at the lowest level or it should be the second one right under the encoding but I choose to place it at the lowest level.

The obvious part of this level is the width and height of the letters, which can be selected with the switches

\tiny         % smalles size
\scriptsize   % size of (first level) super and supscripts
\footnotesize % size of footnotes
\small
\normalsize   % size of regular text
\large
\Large
\LARGE
\huge
\Huge         % biggest size

font size

These font sizes are relative and depend on the selected value for the regular text, which is done with a class option like 11pt, for instance. If you want to set a certain size, you can use \fontsize{<size>}{<baselineskip>}\selectfont.

Beside this obvious sizes there is a thing called optical size which means that the letter forms for tiny sizes are quite different from the ones of a huge size.

optical sizes

The last line shows a text set with \Huge, the first line was set with \tiny and the mid one with \normalsize, all scaled to have the same letter height. As you can see the letters designt to be set in a smaller size are much more robust in the stroke width, their spacing is increased and the letter forms are much wider. That was done by the type designer to keep small text readable and prevent the thin stroke from breaking when printed.

Fortunately LaTeX is smart enough to find the right optical size for the current size of the letters — unfortunately only few typefaces come with different optical sizes.

Font switch vs. Text command

As you can see above, some characteristics can be changed by two macros, like \bfseries and \textbf, some — the size macros – got only one, like \large. I call the ons with an argument text commands because they can be used within the running text (inline) and can be used to change the appearance of a single or few words. The ones without an argument I call font switches because they switch a characteristic on or of, and their effect can only be limited by a group. The font size switches don’t have a accompanying text command because it won’t make much sense to change the font size inline (except footnote marks maybe, but this is done automatically if necessary)! Please keep in mind that there are no environments to change the font, specilly there are no such environments as \begin{large} ... \end{large}!

Why not use \it, \bf etc.?

See Will two-letter font style commands (\bf , \it , …) ever be resurrected in LaTeX?.


code to generate the first image of this post:

\documentclass[tikz,border=5mm]{standalone}

\usepackage{lmodern}

\begin{document}
\begin{tikzpicture}[every node/.style={inner sep=0.25cm,font=\sffamily\bfseries}]
    % Overlaying rectangles
    \begin{scope}[fill=yellow!65!red,nearly transparent]
        % Series
        \fill (-4.25,-2) rectangle (4.25,2);
        \draw [white, opaque, ultra thick] (0,-2) -- (0,2);
        % Size
        \fill (-1.5,-2) rectangle (1.5,2);
        % Family
        \fill (-4.5,-2.25) rectangle (4.5,2.75);
        % Encoding
        \fill (-4.75,-2.5) rectangle (4.75,3.5);
    \end{scope}
    % Text
    \node {4. Size};
    \node at (-4,0)      [right]       {3a. Series};
    \node at (4,0)       [left]        {3b. Shape};
    \node at (-4.5,2.75) [below right] {2a. Typeface and 2b. Family};
    \node at (-4.75,3.5) [below right] {1. Encoding};
\end{tikzpicture}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.