I'm a little confused on the purposes of each kind of text in LaTeX. I know the function of some of them, but sometimes people use each for different reasons. For example:

  • \texttt is for code (no discussion right?).

  • \emph is to make emphasis.

  • \textsc is used for names, right?

  • \textbf when should I use it?

  • \textmd When should I use it?

And something more: If I write for example "HI-TECH C PIC Compiler" in between a paragraph, the capital words doesn't look very good. Is it convenient to use \textsf?

Can normal text be mixed with different types? Under which circumstances?

P.S: I'm using the article class with the normal font.

  • 4
    IS there a right answer to this question. maybe it should be CW?
    – Seamus
    Commented Nov 7, 2010 at 0:54
  • Not a bad idea to make this CW. What do the others thing?
    – Tomas
    Commented Nov 7, 2010 at 6:36
  • For code there is the listings package, which provides syntax highlighting, line numbers.
    – 0x6d64
    Commented Sep 27, 2011 at 8:44

3 Answers 3


I think you are confusing visual markup with semantic markup.

\emph is semantic markup: it indicates that you want to emphasize some text, without specifying how that will affect the appearance of the text. The default is to make it italic, or for nested emph-within-emph to make it roman again. However, the default can be overridden if you later decide to use bold for emphasis: \renewcommand\emph{\textbf}.

\texttt, \textmd, \textsc and so on are visual markup. You should use them for implementing semantic markup. So, for example if you want to use the French convention of using small caps for family names, you could write \newcommand\familyname{\textsc} and have This was studied by John \familyname{Smith} and \familyname{Yao} Ming. If you then later decided that you no longer like this convention it is easy to change, in the preamble without needing to search through your text. Similarly you may want to write \newcommand\code{\texttt}

The visual \textXX commands will change 3 axes of the text: shape, family and weight.

  • The shape axis covers: \textup, \textit, \textsc and \textsl
  • The family axis covers: \textrm, \textsf, \texttt
  • The weight axis covers: \textbf, \textmd
  • Some fonts provide other options along these axes, or even as with MinionPro, completely new axes. (This functionality is now available independent of MinionPro in the fontaxes package, so that it can be used with other fonts.)

You can combine options from the different axes (some combinations, such as \textbf{\textt{...}} are not available by default, discussed here). For example:

  • \newcommand\keyword[1]{\textsf{\textbf{#1}}}
  • \newcommand\important[1]{\textbf{\textit{#1}}}

Regarding "HI-TECH C PIC Compiler": Some fonts (especially ones aimed at newspaper and magazine publishing) have a size of capitals that is intermediate between small-caps (\textsc) and full capitals, for exactly this purpose. The default tex computer modern fonts do not have this possibility, but the computer modern \textsc is not a true small-caps, being a little taller than the x-height of the font, so can be used this way: \newcommand\hitechcomp{\textsc{hi-tech c pic} compiler}

  • Excelent answer. The use of \textsc woud have been good if I didn't have to write numbers! For example, in \textsc{pic18f4520} the numbers are capital sized, while pic and f is lower.
    – Tomas
    Commented Nov 6, 2010 at 16:37
  • 5
    +1 for the difference in semantic vs. visual markup. Even if I want to use a plain \texttt{} for a certain word (e.g. a variable name), I wrap a own command around it (via \newcommand). This way, I can change the appearance of all variables in my text with a single edit.
    – 0x6d64
    Commented Sep 27, 2011 at 8:47

(I have no "right" answer, only some typographical hints.)

Most fonts can be categorized as either serif, sans serif or monospaced:

  • Serif fonts (\textrm) are regularly used for the main text body. (Serifs are the small bars at the end of letter strokes that establish a visual base for text lines.)

  • Sans serif fonts (\textsf) are often used for headings, tables and table/figure captions. (Typesetting the text body in sans serif is often frowned upon because of reasons of legibility.)

  • Monospaced ("typewriter") fonts (\texttt) are mostly limited to code listings and URL's.

For every font category or "family", the following attributes (and combinations of attributes) are possible, although often not available in practice:

  • Medium is the "normal" (upright, non-bold) font. (The commands \textup resp. \textmd are used to cancel the effects of other attribute commands and switch back to a medium font - see Lev Bishop's answer for details.)

  • Italic (\textit) can be used to emphasize parts of the text without making those parts "stick out" at first glance. (\emph defaults to \textit.) Italic fonts are also suited for low-hierarchy headings. Italics are a separate font design - not only are the letters slanted, but many of them (e.g. "a", "g") have distinct forms.

  • Slanted (\textsl) is a surrogate font in case no "real" italic font is around.

  • Bold (\textbf) is suited for (top) headings. In the text body, a bold font should be used only if you really want some words to "stick out" - e.g. keywords in a dictionary.

  • Small caps (\textsc) are another possibility for emphasis. They are sometimes used for names, but are especially suited for acronyms (UNESCO, PIC Compiler) where capital letters would disrupt the text image. "Real" small caps are a separate font design - don't use "faked" small caps (downscaled capital letters).

  • I like the part of \textsf in tables. The problem is: how can I set that font in the hole tabular enviroment?
    – Tomas
    Commented Nov 6, 2010 at 16:40
  • 1
    If your tabular environments are inside table environments, try \usepackage[font=sf]{floatrow}.
    – lockstep
    Commented Nov 6, 2010 at 16:53
  • @lockstep, I'm no typography expert, but I see sans serif fonts are being increasingly used for the main text and serif fonts for the title lines, quite opposite what good old books recommend. Interestingly, that's the style in tex.sx as well. Is there a reason? Commented May 1, 2012 at 20:28

This is a matter of typographic style. There are no definitive rules.

You should consult a style guide to see what is conventionally done. The Elements of Typographic Style and The Chicago Manual of Style are both worth the read.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .