[Tex/LaTex] Is the effect of dollar sign the same as textit

italicmath-mode

It seems I can use $some text in another lang$ instead of (the bigger) \textit{some text in another lang}, may I?

In my opinion, the effect is the same.

Best Answer

No

Really, no!

$ ... $ is the TeX way of entering math mode - specifically, inline math mode. What this means is that it puts you in a mode configured perfectly for mathematics - not italic text.

Using $ ... $ to italicise text will produce some very bad results.

Unless you've got some strange set up, spaces will be ignored, so

$Here is some text$

Produces

enter image description here

The spacing between letters in a word will also be awful, because it's designed for the spacing between strings of mathematical variables, like ab + cd = efg or whatever, not for words. As a result, you'll get irregular gaps between letters:

Compare $Here$ with \textit{Here}

enter image description here

Look at the spacing between the r and the e.

Because you're in math mode, text mode commands will not work.

$p\`{e}re$

Produces the error

LaTeX Warning: Command \` invalid in math mode on input line 6.

! Please use \mathaccent for accents in math mode.
\add@accent ...@spacefactor \spacefactor }\accent 
                                                  #1 #2\egroup \spacefactor ...
l.6 $p\`{e}
           re$
?

Also, if you're using different fonts to the default, your italic font may be different to your maths font.

But leaving all this aside, it violates one of the principles of LaTeX, which is logical structure. One of the key ideas is that I have meaningful commands and environments for producing a given structure. So, instead of hand typing out an enumerated list, putting in all the indents and stuff manually each time, I use an enumerate environment. If I want some mathematics, I enter into math mode. I shouldn't really be using math mode as a hack for something which is not maths, because it messes up the structure of my .tex file.

On that theme, you might like consider using \emph{foo}. Now \emph{} is for emphasising things and by default its behaviour is to make things italic. It also handles nested emphasis, so that

\emph{Never \emph{ever} do that again!}

Produces

enter image description here

Note how the ever is upright.

Here, I am not using a low-level font change command, I've got a structure - emphasis. And when I want to emphasise something I use that. This means that, if I want to change how things are emphasised in my document without going through and changing all the \textits, I can do it by simply redefining \emph. I myself almost never use \textit in a document, but I do usually define a number of commands, such as \work for works (books, plays, movies and so on). Usually such titles are set in italic.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\work}[1]{\textit{#1}}

\begin{document}

I really like \work{Harry Potter and the Order of the Phoenix} and
\work{Harry Potter and the Half-Blood Prince}. \work{Harry Potter and
  the Deathly Hallows} is actually my \emph{least} favourite, though,
which surprised one of my ``friends'' so much, he punched me on the
nose.

\end{document}

enter image description here

But I can effortlessly change this so that all of my titles are put in quotation marks instead.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\work}[1]{``#1''}

\begin{document}

I really like \work{Harry Potter and the Order of the Phoenix} and
\work{Harry Potter and the Half-Blood Prince}. \work{Harry Potter and
  the Deathly Hallows} is actually my \emph{least} favourite, though,
which surprised one of my ``friends'' so much, he punched me on the
nose.

\end{document}

enter image description here

Another thing you might want to look into is using an editor that can speed up the process of inputting commands by defining keyboard shortcuts. Have a look here and see if any take your fancy.

Related Question