14

Supposedly, \emph is more "semantic" while \textit can be seen as an aspect of its implementation. LaTeX has no \strong --- as opposed to, say, HTML which has both <em> and <strong>. So should I roll my own \strong or is it just overkill? Or is there some other, equivalent, command?

10
  • 5
    note that \emph is not just a different name for \textit it's behaviour is also different. – David Carlisle Feb 25 '17 at 9:48
  • 2
    The idea is that emphasis should be realized the same across the document. I think no reader can really catch a nuance between “italic emphasis” and “boldface emphasis”. – egreg Feb 25 '17 at 9:49
  • 2
    I'm not aware of a second command for semantic emphasis. I also doubt that it is necessary. Sometimes "italics" or "bold" is just meant to be "italics" or "bold"; hiding it behind another name then doesn't help. On the other hand, a true emphasis command will take care of the context and choose an appropriate way for adding emphasis, like \emph does: in an upright text \emph will typeset in italics, but in an italics text it typesets upright. – gernot Feb 25 '17 at 9:53
  • 1
    @Ruben - Maybe I wasn't clear enough: The default method for \em's "outer" emphasis is indeed {\itshape ...}. However, this setting isn't immutable: it can be changed by modifying one or more of the macros listed in my answer. Moreover, as I also point out in the answer,\emph allows for emphasis-within-emphasis using just one command, viz., \emph. One could, I suppose, diligently keep track of whether one is about to emphasize some material while in, italic mode and use \textup{...} for those cases. But why not keep life simple and use \emph{... \emph{...} ...}? – Mico Feb 25 '17 at 10:36
  • 2
    You might look at the \alert command from beamer as another 'semantic' command. (I wouldn't use it in most non-beamer documents, however.) – jon Feb 25 '17 at 17:05
19

The idea behind \emph is that it provides a high level way for giving emphasis to a part of the text. High level in the sense it is “independent” of the actual implementation.

The default behavior of \emph is to use italics when in an upright context and upright when in an italics context, but this can be modified on a document’s basis (or by a package implementing a particular style). In particular, your question has no real answer: \emph and \textit bear no “abstract” relationship; the relationship is only at the default implementation level.

This is different from stating some part of text is in italics; for instance, theorems are commonly typeset in italics and the styles use \itshape for this, not \em (the declarative form of \emph). Similarly they use \bfseries for the theorem tag (or \scshape or whatever).

You're free to define as many similar commands as you want. If your style requires a sort of “strong emphasis”, you can define \strong as you please, maybe using \bfseries in normal context and \extrabfseries (if your font supports it, the name is hypothetical) in a \strong context. Before doing this, think deeply whether your readers will be able to appreciate the difference between \emph{word} and \strong{word} (which I think they won't).

10

There may be some confusion as to how \emph and \em are defined. From the latex kernel (cf latex.ltx):

\DeclareTextFontCommand{\emph}{\em}
\DeclareRobustCommand\em
        {\@nomath\em \ifdim \fontdimen\@ne\font >\z@
                       \eminnershape \else \itshape \fi}%
\def\eminnershape{\upshape}%

Basically, \emph (via \em) checks if it's already in "emphasis mode". If it's not, \itshape is executed; and if it is, \eminnnershape -- which, by default, is set to \upshape -- is executed. (\eminnershape can be modified via a \renewcommand instruction. E.g., running \renewcommand\eminnershape{\scshape}} would select small-caps for "inner" emphasized material.)

So it's not the case that \emph is just "more semantic" than \textit. Indeed, \emph is more semantic -- it lets you choose the method of typographic emphasis (the defaults are \itshape for "outer" and \upshape for "inner" material) -- but it also provides a way of providing emphasis within emphasized material.

Finally, just in case you're curious how \DeclareTextFontCommand is defined in the LaTeX kernel, here goes:

\def \DeclareTextFontCommand #1#2{%
  \DeclareRobustCommand#1[1]{%
    \ifmmode
      \nfss@text{#2##1}%
    \else
      \hmode@bgroup
       \text@command{##1}%
       #2\check@icl ##1\check@icr
       \expandafter
      \egroup
    \fi
                       }%
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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