Use consistent shadows across Geany
[geany-mirror.git] / tests / ctags / intro_orig.tex
blob6a03d140a88bb87801eaa63bc45c4dbd9b314674
1 % http://sip.clarku.edu/tutorials/TeX/intro.html
2 \documentclass[12pt]{article}
4 \usepackage{amsmath} % need for subequations
5 \usepackage{graphicx} % need for figures
6 \usepackage{verbatim} % useful for program listings
7 \usepackage{color} % use if color is used in text
8 \usepackage{subfigure} % use for side-by-side figures
9 \usepackage{hyperref} % use for hypertext links, including those to external documents and URLs
11 % don't need the following. simply use defaults
12 \setlength{\baselineskip}{16.0pt} % 16 pt usual spacing between lines
14 \setlength{\parskip}{3pt plus 2pt}
15 \setlength{\parindent}{20pt}
16 \setlength{\oddsidemargin}{0.5cm}
17 \setlength{\evensidemargin}{0.5cm}
18 \setlength{\marginparsep}{0.75cm}
19 \setlength{\marginparwidth}{2.5cm}
20 \setlength{\marginparpush}{1.0cm}
21 \setlength{\textwidth}{150mm}
23 \begin{comment}
24 \pagestyle{empty} % use if page numbers not wanted
25 \end{comment}
27 % above is the preamble
29 \begin{document}
31 \begin{center}
32 {\large Introduction to \LaTeX} \\ % \\ = new line
33 \copyright 2006 by Harvey Gould \\
34 December 5, 2006
35 \end{center}
37 \section{Introduction}
38 \TeX\ looks more difficult than it is. It is
39 almost as easy as $\pi$. See how easy it is to make special
40 symbols such as $\alpha$,
41 $\beta$, $\gamma$,
42 $\delta$, $\sin x$, $\hbar$, $\lambda$, $\ldots$ We also can make
43 subscripts
44 $A_{x}$, $A_{xy}$ and superscripts, $e^x$, $e^{x^2}$, and
45 $e^{a^b}$. We will use \LaTeX, which is based on \TeX\ and has
46 many higher-level commands (macros) for formatting, making
47 tables, etc. More information can be found in Ref.~\cite{latex}.
49 We just made a new paragraph. Extra lines and spaces make no
50 difference. Note that all formulas are enclosed by
51 \$ and occur in \textit{math mode}.
53 The default font is Computer Modern. It includes \textit{italics},
54 \textbf{boldface},
55 \textsl{slanted}, and \texttt{monospaced} fonts.
57 \section{Equations}
58 Let us see how easy it is to write equations.
59 \begin{equation}
60 \Delta =\sum_{i=1}^N w_i (x_i - \bar{x})^2 .
61 \end{equation}
62 It is a good idea to number equations, but we can have a
63 equation without a number by writing
64 \begin{equation}
65 P(x) = \frac{x - a}{b - a} , \nonumber
66 \end{equation}
67 and
68 \begin{equation}
69 g = \frac{1}{2} \sqrt{2\pi} . \nonumber
70 \end{equation}
72 We can give an equation a label so that we can refer to it later.
73 \begin{equation}
74 \label{eq:ising}
75 E = -J \sum_{i=1}^N s_i s_{i+1} ,
76 \end{equation}
77 Equation~\eqref{eq:ising} expresses the energy of a configuration
78 of spins in the Ising model.\footnote{It is necessary to process (typeset) a
79 file twice to get the counters correct.}
81 We can define our own macros to save typing. For example, suppose
82 that we introduce the macros:
83 \begin{verbatim}
84 \newcommand{\lb}{{\langle}}
85 \newcommand{\rb}{{\rangle}}
86 \end{verbatim}
87 \newcommand{\lb}{{\langle}}
88 \newcommand{\rb}{{\rangle}}
89 Then we can write the average value of $x$ as
90 \begin{verbatim}
91 \begin{equation}
92 \lb x \rb = 3
93 \end{equation}
94 \end{verbatim}
95 The result is
96 \begin{equation}
97 \lb x \rb = 3 .
98 \end{equation}
100 Examples of more complicated equations:
101 \begin{equation}
102 I = \! \int_{-\infty}^\infty f(x)\,dx \label{eq:fine}.
103 \end{equation}
104 We can do some fine tuning by adding small amounts of horizontal
105 spacing:
106 \begin{verbatim}
107 \, small space \! negative space
108 \end{verbatim}
109 as is done in Eq.~\eqref{eq:fine}.
111 We also can align several equations:
112 \begin{align}
113 a & = b \\
114 c &= d ,
115 \end{align}
116 or number them as subequations:
117 \begin{subequations}
118 \begin{align}
119 a & = b \\
120 c &= d .
121 \end{align}
122 \end{subequations}
124 We can also have different cases:
125 \begin{equation}
126 \label{eq:mdiv}
127 m(T) =
128 \begin{cases}
129 0 & \text{$T > T_c$} \\
130 \bigl(1 - [\sinh 2 \beta J]^{-4} \bigr)^{\! 1/8} & \text{$T < T_c$}
131 \end{cases}
132 \end{equation}
133 write matrices
134 \begin{align}
135 \textbf{T} &=
136 \begin{pmatrix}
137 T_{++} \hfill & T_{+-} \\
138 T_{-+} & T_{--} \hfill
139 \end{pmatrix} , \nonumber \\
141 \begin{pmatrix}
142 e^{\beta (J + B)} \hfill & e^{-\beta J} \hfill \\
143 e^{-\beta J} \hfill & e^{\beta (J - B)} \hfill
144 \end{pmatrix}.
145 \end{align}
146 and
147 \newcommand{\rv}{\textbf{r}}
148 \begin{equation}
149 \sum_i \vec A \cdot \vec B = -P\!\int\! \rv \cdot
150 \hat{\mathbf{n}}\, dA = P\!\int \! {\vec \nabla} \cdot \rv\, dV.
151 \end{equation}
153 \section{Tables}
154 Tables are a little more difficult. TeX
155 automatically calculates the width of the columns.
157 \begin{table}[h]
158 \begin{center}
159 \begin{tabular}{|l|l|r|l|}
160 \hline
161 lattice & $d$ & $q$ & $T_{\rm mf}/T_c$ \\
162 \hline
163 square & 2 & 4 & 1.763 \\
164 \hline
165 triangular & 2 & 6 & 1.648 \\
166 \hline
167 diamond & 3 & 4 & 1.479 \\
168 \hline
169 simple cubic & 3 & 6 & 1.330 \\
170 \hline
171 bcc & 3 & 8 & 1.260 \\
172 \hline
173 fcc & 3 & 12 & 1.225 \\
174 \hline
175 \end{tabular}
176 \caption{\label{tab:5/tc}Comparison of the mean-field predictions
177 for the critical temperature of the Ising model with exact results
178 and the best known estimates for different spatial dimensions $d$
179 and lattice symmetries.}
180 \end{center}
181 \end{table}
183 \section{Lists}
185 Some example of formatted lists include the
186 following:
188 \begin{enumerate}
190 \item bread
192 \item cheese
194 \end{enumerate}
196 \begin{itemize}
198 \item Tom
200 \item Dick
202 \end{itemize}
204 \section{Figures}
206 We can make figures bigger or smaller by scaling them. Figure~\ref{fig:lj}
207 has been scaled by 60\%.
209 \begin{figure}[h]
210 \begin{center}
211 \includegraphics{figures/sine}
212 \caption{\label{fig:typical}Show me a sine.}
213 \end{center}
214 \end{figure}
216 \begin{figure}[h]
217 \begin{center}
218 \scalebox{0.6}{\includegraphics{figures/lj}}
219 \caption{\label{fig:lj}Plot of the
220 Lennard-Jones potential
221 $u(r)$. The potential is characterized by a length
222 $\sigma$ and an energy
223 $\epsilon$.}
224 \end{center}
225 \end{figure}
227 \section{Literal text}
228 It is desirable to print program code exactly as it is typed in a
229 monospaced font. Use \verb \begin{verbatim} and
230 \verb \end{verbatim} as in the following example:
231 \begin{verbatim}
232 double y0 = 10; // example of declaration and assignment statement
233 double v0 = 0; // initial velocity
234 double t = 0; // time
235 double dt = 0.01; // time step
236 double y = y0;
237 \end{verbatim}
238 The command \verb \verbatiminput{programs/Square.java}\ allows
239 you to list the file \texttt{Square.java} in the directory
240 programs.
242 \section{Special Symbols}
244 \subsection{Common Greek letters}
246 These commands may be used only in math mode. Only the most common
247 letters are included here.
249 $\alpha,
250 \beta, \gamma, \Gamma,
251 \delta,\Delta,
252 \epsilon, \zeta, \eta, \theta, \Theta, \kappa,
253 \lambda, \Lambda, \mu, \nu,
254 \xi, \Xi,
255 \pi, \Pi,
256 \rho,
257 \sigma,
258 \tau,
259 \phi, \Phi,
260 \chi,
261 \psi, \Psi,
262 \omega, \Omega$
264 \subsection{Special symbols}
266 The derivative is defined as
267 \begin{equation}
268 \frac{dy}{dx} = \lim_{\Delta x \to 0} \frac{\Delta y}
269 {\Delta x}
270 \end{equation}
271 \begin{equation}
272 f(x) \to y \quad \mbox{as} \quad x \to
273 x_{0}
274 \end{equation}
275 \begin{equation}
276 f(x) \mathop {\longrightarrow}
277 \limits_{x \to x_0} y
278 \end{equation}
280 \noindent Order of magnitude:
281 \begin{equation}
282 \log_{10}f \simeq n
283 \end{equation}
284 \begin{equation}
285 f(x)\sim 10^{n}
286 \end{equation}
287 Approximate equality:
288 \begin{equation}
289 f(x)\simeq g(x)
290 \end{equation}
291 \LaTeX\ is simple if we keep everything in proportion:
292 \begin{equation}
293 f(x) \propto x^3 .
294 \end{equation}
296 Finally we can skip some space by using commands such as
297 \begin{verbatim}
298 \bigskip \medskip \smallskip \vspace{1pc}
299 \end{verbatim}
300 The space can be negative.
302 \section{\color{red}Use of Color}
304 {\color{blue}{We can change colors for emphasis}},
305 {\color{green}{but}} {\color{cyan}{who is going pay for the ink?}}
307 \section{\label{morefig}Subfigures}
309 As soon as many students start becoming comfortable using \LaTeX, they want
310 to use some of its advanced features. So we now show how to place two
311 figures side by side.
313 \begin{figure}[h!]
314 \begin{center}
315 \subfigure[Real and imaginary.]{
316 \includegraphics[scale=0.5]{figures/reim}}
317 \subfigure[Amplitude and phase.]{
318 \includegraphics[scale=0.5]{figures/phase}}
319 \caption{\label{fig:qm/complexfunctions} Two representations of complex
320 wave functions.}
321 \end{center}
322 \end{figure}
324 We first have to include the necessary package,
325 \verb+\usepackage{subfigure}+, which has to go in the preamble (before
326 \verb+\begin{document}+). It sometimes can be difficult to place a figure in
327 the desired place.
329 Your LaTeX document can be easily modified to make a poster or a screen
330 presentation similar to (and better than) PowerPoint. Conversion to HTML is
331 straightforward. Comments on this tutorial are appreciated.
333 \begin{thebibliography}{5}
335 \bibitem{latex}Helmut Kopka and Patrick W. Daly, \textsl{A Guide to
336 \LaTeX: Document Preparation for Beginners and Advanced Users},
337 fourth edition, Addison-Wesley (2004).
339 \bibitem{website}Some useful links are
340 given at \url{}.
342 \end{thebibliography}
344 {\small \noindent Updated 5 December 2006.}
345 \end{document}