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.

I have only ever used \textit (and \emph for emphasized text), but have noticed that in some TeX examples, \itshape is used instead of \textit. Is there a difference between \textit and \itshape? If so, what is that difference?

share|improve this question
add comment

3 Answers 3

up vote 31 down vote accepted

\itshape is a switch:

Not italic {\itshape Italic} Not italic

\textit takes an argument:

Not italic \textit{Italic} Not italic

Many people seem to like \itshape{...}, which is wrong (but doesn't give an error since the braces are interpreted as grouping delimiters here). \itshape doesn't automatically insert italic correction, whereas \textit does, so inside a paragraph, \textit is usually better. On the other hand, sometimes the switch commands are more handy if you already have grouping (e.g., with braces or environments):

\begin{table}
  \itshape
  Everything inside this table is italic
\end{table}
share|improve this answer
    
So would \itshape be best reserved for fully italicized paragraphs (where there is no need for additional spacing at the end of the paragraph)? –  squidbear Dec 31 '10 at 20:49
1  
@quidbear, I would pretty much always use \textit (actually \emph), and only reserve \itshape for defining new commands and environments. –  Juan A. Navarro Jan 24 '11 at 11:07
add comment
  • \itshape is a declaration. It affects the following text. That's why it's often used for larger amounts of text or within a group. In contrast, \textit affects only its argument.

  • \textit provides italic correction, \itshape does not. This means, that immediately after an italic text made by \textit there's a little more space before the following text, compared with \itshape. A reason for the correction is, that because of the slanting the spacing could be too narrow, visually. It depends on the font.

  • \textit works in math mode, \itshape doesn't work in math mode.

Here's code for \textit, from latex.ltx:

\DeclareTextFontCommand{\textit}{\itshape}

\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
                       }%
}

As you can see, \textit uses \itshape but does more regarding math mode and italic correction.

share|improve this answer
add comment

\itshape and others like it (bfseries) are modal commands which don't take arguments. They change all succeeding text to that font shape/weight etc. \textit (and textbf) is a macro that takes an argument.

share|improve this answer
add comment

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.