Is the effect of dollar sign the same as textit?
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
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}
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
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 \textit
s, 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}
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}
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.
Just one more example, to extend @Au101 answer. Numbers' behaviour is completely different.
\documentclass{article}
\begin{document}
\textit{2} vs. $2$
And even \verb+\textit{$2$}+: \textit{$2$} does not make 2 italic.
\end{document}
Still another extension to @Au101's answer: The math italic font, which is the font that TeX uses to typeset letters in math mode, does not insert typographic ligatures. In contrast, in text italic mode (as well as in text upright or "roman" mode), TeX will automatically insert any available ligatures. E.g.,
$difficult\ office$ vs.\ \textit{difficult office}
Or:
$off\ fit\ fly\ baffle$ vs.\ \textit{off fit fly baffle}