to stress a point or highlight a key term. Filenames might be set in \\texttt{typewriter text} (although you should consider using the \\package{url} package to help you out---by default, text set in
typewriter text isn't hyphenated, which can lead to some unattractive line breaks).
You can also set text in \\textsf{sans serif} or \\textsc{small caps}.
Table~\\ref{tab:font-commands} shows you some of the most commonly used font commands provided by \\latex.
\\begin{table}[htbp] \\centering \\begin{tabular}{ll} \\toprule
Command & Result\\\\ \\midrule
\\com{emph} & \\emph{emphasized text}\\\\ \\com{textsf} & \\textsf{sans-serif text}\\\\ \\com{texttt} & \\texttt{typewriter text}\\\\ \\com{textbf} & \\textbf{bold text}\\\\ \\com{textsc} & \\textsc{small caps text}\\\\ \\com{textsl} & \\textsl{slanted text}\\\\ \\com{textit} & \\textit{italic text}\\\\ \\bottomrule \\end{tabular}
\\caption[Commonly used font commands]{Commonly used font commands.} \\label{tab:font-commands}
\\end{table}
I recommend that you use \\com{emph} in preference to \\com{textit}, and use \\com{textbf} sparingly. \\com{emph} is a smarter command than \\com{textit}---it switches back to the roman font when necessary. For example, \\emph{She loved \\emph{Scooby Doo}.} versus \\textit{He loved \\textit{Titanic}.}
For complicated font changes, or for special font usages that you're typing a lot, creating a macro (Section~\\ref{sec:customization}) is the way to go. I often just write, tossing in custom commands as I go, and waiting to define them until just before I compile the document.
\\subsection{Customization}% \\label{sec:customization}
The main advantage of using commands and environments is that they allow you to organize your writing. A useful side-effect is that you can change your mind about the way an element is typeset, and change all the appearances of that element in document by editing one piece of code. For example, in this document the names of environments have been set in ``typewriter text'', using a command I created called \\command{env}, which is defined as \\begin{quote} \\begin{verbatim}
\\newcommand{\\env}[1]{\\texttt{#1}\\xspace} \\end{verbatim} \\end{quote}
All I have to do to make the names of all the environments in the document appear in sans-serif type instead is to change that one line to
\\begin{quote} \\begin{verbatim}
\\newcommand{\\env}[1]{\\textsf{#1}\\xspace} \\end{verbatim}
\\end{quote}
You can do the same with almost anything you can conceptualize---key terms, people's names (especially names of people from non-English-speaking countries), files, functions, and so on.
\\section{Mathematical Notation}% \\label{sec:mathematical-notation}
As we saw in Section~\\ref{sec:math-environments}, math is typed into one of several kinds of math environments. Choose your environment based on the context and importance of the content. Any formula you plan to refer to should be typed in an \\env{equation} environment (or a similar environment that supports labels).
You should punctuate your mathematics as if the formulae were normal parts of English sentences. Reading them aloud is often a useful method for ensuring that you have all the commas in the right places. Where appropriate, you should also follow a displayed formula at the end of a sentence with a period.
\\subsection{Sums and Products}%
\\label{sec:sums-n-products}
It's easy to typeset sums and products. For example, \\begin{equation}
f(n) = \\sqrt[n]{\\sum_{k=1}^{n} {n \\choose k} f \\left( n - k \\right)},~ \\prod_{n=2}^{\\infty} \\frac{n^{3}-1}{n^{3}+1} = \\frac{2}{3}. \\end{equation}
%%% The ~ in the equation puts a nonbreaking space (equivalent to an %%% interword space in text mode) between the two halves of the equation. %%%
%%% Also, note that the use of the \\choose command here causes the %%% amsmath package to issue the warning %%%
%%% Package amsmath Warning: Foreign command \\atopwithdelims;
%%% (amsmath) \\frac or \\genfrac should be used instead %%% (amsmath) on input line 557. %%%
%%% amsmath would prefer the use of the \\binom command it supplies.
\\subsection{Matrices}% \\label{sec:matrices}
It's a little more difficult to create matrices, but not too bad:
%%% In LaTeX, & is the alignment tab, and separates columns. \\\\ is the end of %%% line marker, and separates rows. The ccc denotes that there are three %%% columns. The array environment and the tabular environment are %%% more or less identical, so what goes here also applies to a table. %%%
\\begin{equation}
\\left[ \\begin{array}{ccc} 2 & 1 & 2\\\\ 1 & 0 & 2\\\\ 2 & 1 & 1
\\end{array} \\right] \\left[ \\begin{array}{ccc} -2 & 1 & 2\\\\ 3 & -2 & -2\\\\ 1 & 0 & -1 \\end{array} \\right] = \\left[ \\begin{array}{ccc} 1 & 0 & 0\\\\ 0 & 1 & 0\\\\
0 & 0 & 1 \\end{array} \\right]. \\end{equation}
\\subsection{Symbols}% \\label{sec:symbols}
\\LaTeX provides an enormous number of symbols. Additional packages (loaded with \\com{usepackage}) may provide additional symbols and fonts.
For example, $\\mathbb{N}$, $\\mathbb{Z}$, $\\mathbb{Q}$, $\\mathbb{R}$, and $\\mathbb{C}$ require you to load the \\package{amsfonts} package (which is automatically loaded by the \\texttt{icmmcm} class). These symbols are generated by \\com{mathbb}, which only works in math mode.
Subscripts and superscripts are easy---\\verb!$a_n$! produces $a_n$, and \\verb!$x^2$! produces $x^2$. Ordinal numbers, such as $3^{\\textrm{rd}}$, $n^{\\textrm{th}}$, and so forth,\\footnote{Some fonts may include their own ordinals that can be accessed with special commands.} can be produced with code like \\verb!$3^{\\textrm{rd}}$!, \\verb!$n^{\\textrm{th}}$!.
Equation~\\ref{eq:superscript} shows a formula with a superscript. \\begin{equation}
\\label{eq:superscript}
\\int_{0}^{\\pi} \\, \\cos^{2n+1} x \\, {\\rm d} x = 0 \\qquad
\\forall \\, n \\in \\mathbb{N}. \\end{equation}
Notice that \\com{cos} produces a nice roman ``$\\cos$'' within math mode. There are similar commands for common functions like \\com{log}, \\com{exp}, and so forth. More can be defined with the
\\com{DeclareMathOperator} command provided by the \\package{amsmath} package.
You can stack symbols over other symbols. In math formulas, \\begin{equation}
m\\ddot{x} + \\gamma\\dot{x} + kx = 0, \\end{equation}
or to produce diacritical accents, as in \\begin{quote}
Paul Erd\\H{o}s s'est reveill\\'{e} t\\^{o}t pour enseigner le fran\\c{c}ais \\`{a} son fr\\`{e}re et sa s\\oe{}ur. \\end{quote}
相关推荐: