forked from Sravan2j/SJSU-thesis-LaTeX
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathchap1.tex
executable file
·174 lines (131 loc) · 6.71 KB
/
chap1.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
\chapter{The Basics}
\LaTeX\ can be viewed
as a compiled programming language, in contrast to that
nightmare known as Microsoft Word,
which can be viewed as an interpreted language. So, to typeset a
document in \LaTeX, you create a text file that has the {\tt .tex} extension.
This file includes some special
commands, known as macros. Then
you compile your {\tt .tex} file by running \LaTeX,
which produces your typeset document, as a pdf.
In this paper, a few basics are discussed. There are plenty of good online resource
if you need help with more advanced topics.
\section{Typesetting Text}
To typeset text, you type whatever you want. Multiple spaces are
ignored when typesetting, and
the end of a line is treated as another space.
Consequently, when you are typing, you can break lines anywhere, like here
or here,
since the lines are formatted automatically when you typeset the document.
You start a new paragraph by leaving a blank line.
See how easy it is to start a new paragraph? A blank line does the trick.
\section{Special Characters}
Typesetting text is generally pretty easy. However, there are some special
characters that will not be typeset as you might expect. In the remainder of this
section we consider some of the most common of these
special characters.
The backslash ``\verb+\+'' is used
as the ``escape'' character, meaning that
whatever follows a backslash is interpreted as a macro.
For example, when \verb+\LaTeX+ is typeset, it looks like \LaTeX, which
is a lot different from LaTeX.
To get double quotes, use two single quotes. That is, the left double quote is ``, while the right double
quote is ''. When you do it correctly, quoted text looks ``like this.''
If you use the double quote key, you will always get right-quotes, which looks "like this," and is
almost certainly not what you want.
A tilde ``\verb+~+'' is used as a ``tie,'' that is, a space is inserted, but no line break can occur.
For example, you might type Dr.~Stamp just to be sure that the line of text
does not break between Dr. and Stamp, as it otherwise might.
The percent sign is used for comments---everything following a percent sign
on a given line is ignored when you \LaTeX\ your file. % Like this stuff here
If you want a percent sign to appear in your document, use \verb+\%+,
which will give you this \%.
The dollar sign also has special meaning, since it is used to start and end
math formulas. To typeset a dollar sign, use \verb+\$+, like this~\$.
To force \LaTeX\ to insert a space, use a backslash followed by
a space, that is, \verb+\ +. You can put in multiple extra spaces\ \ \ \ \ \ \ if you want.
\section{Fonts}
To change fonts, enclose the text in curly brackets and give the appropriate font command.
For example, to italicize text, {\it do this}, and to get boldface, {\bf this is the ticket}.
Another useful font is {\tt this one}, which produces a typewriter-like font.
\section{Math Basics}
Math typesetting is a big, big, big topic---here we just cover some of
the most basic issues. For more information, look online.
The dollar sign is used to start and end math formulas, like~$\pi r^2$.
If you want your formula displayed on a line by itself, then double
dollar signs
$$
d(X,Y) = \sum_{i,j} |x_{ij} - y_{ij}|
$$
are your friend.
In math formulas, text gets typeset as math symbols. To
insert regular text in a math formula, you can use the \verb+\mbox+
command. Here is an example of a displayed equation with text
$$
{n\choose 26} 26!\; 26^{n-26} < 26^n \approx 2^{4.7n} \mbox{ is a pretty formula} .
$$
\subsection{Numbered Equations}
One of the most useful features of \LaTeX\ is its symbolic cross-references.
What this means is that you can give names to equations, figures, tables, citations, etc., and
refer to those equations, figures, tables, citations, etc., by their names. Then when you \LaTeX\
the document, the correct numbers will magically appear in place of the
names. This is very convenient when you move things around or you insert or delete
stuff. You should definitely use this feature as much as possible.
In this section, we discuss numbered equations, Then in Chapter~\ref{chap:blah}
we consider other examples of symbolic cross-referencing.
Again, this is a feature you should use, since it will save
you a lot of time in the long run.
To typeset a displayed equation with a number, you can
use \verb+\begin{equation}+ to begin the equation, and \verb+\end{equation}+
to end the equation. You also want to provide a label for the equation.
For example,
\begin{equation}\label{eq:swaps}
\sum_{i = 1}^{26} m_i \bigg( n - \sum_{j=1}^i m_j \bigg)
= n^2 - \sum_{i = 1}^{26} m_i \sum_{j=1}^i m_j = \sum_{i=1}^{25} \sum_{j=i+1}^{26} m_i m_j
\end{equation}
gives us a numbered equation.
Note that labels can be used for
just about anything that is numbered. Generally, to refer to a label,
we use \verb+\ref{label}+, but for equations, you probably want to use
\verb+\eref{label}+, since that will put parenthesis around the number.
So, we can now refer to equation~\eref{eq:swaps} anywhere in the paper.
Better yet, if we move, insert, or delete text, the numbering will still be correct.
\subsection{Last Word on Equations}
Again, typesetting equations is a big topic and we have only given the most basic
of basics here. Just remember that almost anything is possible, and there
are plenty of good resources available.
\section{Lists}
Numbered lists are not difficult. Here is an example
of a numbered list:
\begin{enumerate}
\item Let $\mbox{\tt score} = \infty$
\item Construct an initial {\tt putativeKey}
\item Parse the ciphertext using {\tt putativeKey}
\item Compute {\tt newScore} based on the resulting putative plaintext
\item If $\mbox{\tt newScore} < \mbox{\tt score}$ then
let $\mbox{\tt key} = \mbox{\tt putativeKey}$ and $\mbox{\tt score} = \mbox{\tt newScore}$
\item Modify {\tt key} to obtain a new {\tt putativeKey}
\item Goto~3
\end{enumerate}
Bulleted lists are similar to numbered lists. Here is an example of a bulleted list:
\begin{itemize}
\item How can we determine an initial putative key?
\item How can we systematically modify the key?
\item Given a putative key, how can we compute a score?
\end{itemize}
\section{Verbatim}
To force \LaTeX\ to typeset exactly what you type, you might want to use the \verb+\verb+
macro. Here is an example:
\verb+four score and seven+. Note that everything between the ``+'' signs
is typeset as it appears.
If you happen to have a lot of verbatim text, you can use the verbatim environment,
like this:
\begin{verbatim}
Four score
and seven
years
ago.........
\end{verbatim}
Generally, verbatim should be used sparingly, if at all. But, since
verbatim text has already appeared several times in this document, I thought it
should be explained.