Intro To Latex, Part Ii: Math, Bibtex, and Customization: David Diez
Intro To Latex, Part Ii: Math, Bibtex, and Customization: David Diez
Intro To Latex, Part Ii: Math, Bibtex, and Customization: David Diez
David Diez
OpenIntro
openintro.org
Outline
Mathematics in LaTeX
BibTeX: bibliographies in LaTeX
Building your own commands and environments
Miscellaneous tips
Guide to LaTeX
Math in LaTeX
The $ signs tell LaTeX when to switch into or out of math model.
For instance, to create α above, type $\alpha$.
Equation array
Equation referencing
Aligned equations
Result:
Multiple alignments
outputs
(a + b)0 = 1 (a + b)1 = a + b
(a + b)2 = a2 + 2ab + b2 (a + b)3 = a3 + 3a2 b + 3ab2 + b3
Math BibTeX Customization Wrap-up
It is a little difficult to learn all the math syntax and a good help
source is the LaTeX and Matrix Panels:
Some symbols
Character modifications
√
And we can combine them as well: √ 4+3 = 59 .
16+5
Math BibTeX Customization Wrap-up
which results in
∞ Z 2
X
i 1
p = 3x2 dx = 7
1−p 1
i=0
X∞ Z1
i
0.5 = 2 3x2 dx = 0
i=0
1
Practice
Sizing of Brackets
Generally we can use \left(, \left[, \left|, and \left\{ and their
corresponding right brackets to create automatically sized brackets.
These commands must be inside one of the equations environments
and the left and right brackets must always be balanced.
Math BibTeX Customization Wrap-up
Matrices
The code:
\begin{eqnarray∗ }
E(X+Y) \stackrel{indep.}{=} E(X) + E(Y)
\quad\quad
Var(X+Y) \stackrel{indep.}{=} Var(X) + Var(Y)
\end{eqnarray∗ }
produces
indep. indep.
E(X + Y ) = E(X) + E(Y ) V ar(X + Y ) = V ar(X) + V ar(Y
Math BibTeX Customization Wrap-up
There are three steps that LaTeX and BibTeX take to make a
bibliography.
When you typeset a document with citations (e.g.
\cite{zotova}), LaTeX makes note of each citation.
BibTeX takes this list and looks for each reference in a
database of publications.
Then we tell LaTeX to make the bibliography of all of those
publications it found that we referenced.
The most time consuming part is initially building the database.
After that, you can reference this same database over and over
again and BibTeX becomes a breeze.
Math BibTeX Customization Wrap-up
BibTeX material
label
z }| {
@article{zotova,
Author = {Elena Zotova and Charles D Woody and Ehud
Gruen},
Journal = {Brain Research},
Pages = {66-78},
Title = {Multiple representations ... [etc etc].},
Volume = {868},
Year = {2000}}
Math BibTeX Customization Wrap-up
Make up of a reference
An alternative
Special cases
Sometimes you don’t want your entry to include the entire journal
name. To shorten it, use the string entry type:
@string{JSS = {Journal of Statistical Software}}
These string entries must be defined in the database above where
they are used.
Math BibTeX Customization Wrap-up
Citing a reference
Practice
Counters
Creating commands
Creating environments
Math BibTeX Customization Wrap-up
Existing counters
We may want to create our own counters for our own purposes.
Maybe we have examples that we want numbered.
\newcounter{counterName}[inCounter]
This creates a new counter called counterName. The inCounter
argument + brackets are optional and an inCounter is used to
reset counterName whenever inCounter increments (e.g.
subsection has “inCounter” section).
Math BibTeX Customization Wrap-up
Modifying
Printing
Simple command
Generalization
Sample environment
General environment
Environment + counter
\newcounter{example}
\setcounter{example}{0}
\newenvironment{example}
{\refstepcounter{example}\small
\textbf{Example \arabic{example}.}\hspace{2mm}}
{\\}
Math BibTeX Customization Wrap-up
\include{otherDocName}
Wrap-up
Any questions?