Advanced LATEX
Joel Berger
November 12, 2009
Contents 4 UICThesi 8
1 Introduction 1
2 Tool Chain 1
1 Introduction
2.1 Eclipse / TEXlipse . . . . . . . . . . 2
In this talk I intend to give a brief overview of the
2.1.1 Installation . . . . . . . . . . 2
tool, techniques and packages that I use to make
2.1.2 Setup . . . . . . . . . . . . . 2
the most LATEX. Some in the audience may know
2.1.3 Benefits . . . . . . . . . . . . 2 some or all of these things or may have other meth-
2.1.4 Use . . . . . . . . . . . . . . 3 ods to accomplish these tasks. I hope you will share
2.2 Zotero . . . . . . . . . . . . . . . . . 3 those in our discussion!
2.3 BibTEX . . . . . . . . . . . . . . . . 3 Further this outline is made for both of a series of
2.3.1 General Use . . . . . . . . . . 3 talks I am giving on this topic, on in the CS depart-
2.3.2 As Part of Toolchain . . . . . 4 ment and one in the Physics department. In these
2.4 Creating Graphics . . . . . . . . . . 4 talks I may focus on slightly different material; in
2.4.1 SVG Images / Inkscape . . . 4 the CS talk I may focus more on the Beamer class
2.4.2 QtiPlot . . . . . . . . . . . . 4 than the toolchain as this audience may have its
2.4.3 Mathematica Export . . . . . 4 toolchain decided upon; in Physics, as I know some
2.4.4 GIMP . . . . . . . . . . . . . 5 of you are new to LATEX as well as programming
2.4.5 TikZ Package . . . . . . . . . 5 I may spend more time on the toolchain and its
relationship to using BibTEX. Both groups should
3 Beamer 5 familiarize themselves, at some point, with UIC-
3.1 Basics . . . . . . . . . . . . . . . . . 5 Thesi.
3.1.1 Themes . . . . . . . . . . . . 5
3.1.2 Title Material . . . . . . . . . 5
3.1.3 Frames . . . . . . . . . . . . 5 2 Tool Chain
3.1.4 Blocks . . . . . . . . . . . . . 6
3.1.5 Columns and Graphics . . . . 6 Your toolchain includes your LATEX distribution
3.1.6 Sectioning and Outline Pages 6 (i.e. MikTEX), your editor and any other software
3.2 Additional Documents . . . . . . . . 7 that you use to produce your documents. You may
3.2.1 Beamer . . . . . . . . . . . . 7 choose the software in your toolchain to suit any
3.2.2 Handout . . . . . . . . . . . . 7 purpose that you have. There are some LATEX pro-
3.2.3 Article (Lecture Notes) . . . 8 grams that I use in order to produce my documents
3.3 Impress!ve . . . . . . . . . . . . . . . 8 quickly and with lots of simplifications built in to
3.4 Posters with Beamer . . . . . . . . . 8 ease the process.
1
2.1 Eclipse / TEXlipse directory to your LaTeX folder. Similarly find
your viewer, this might be acrobat reader, though
Eclipse is a free software development program.
I like using a program called Xpdf because it
Remember that your LATEX source is actually a
can refresh the viewed document for when you
software program defining the document you want
recompile.
to produce. TEXlipse is a free plugin for Eclipse
that provdes LATEX integration.
TEXworks is a simplistic, stipped-down LATEX 2.1.3 Benefits
editor that has two advantages: A clean interface Some of the reasons I like this editor are
that isn’t scary to newcomers and inverse search in
PDF documents. It is just fine to stay with the • Code folding
clean interface if you like that, but other editors
have added features that TEXworks gives away in • Colorization
the name of simplicity. The one exception is the in-
verse search. Almost all editors can inverse search • Error/Warning sorting
in DVI mode, but that document format has been
supplanted by PDF. TEXworks is the first (and al- • Tasks (ToDo menu)
most only) to have inverse search in PDF mode; if • Table entry
you love this feature you may want to stick with
this as your editor. Otherwise trying out other ed- • Outline view (even with included documents)
itors may help you streamline your document pro-
duction. • Autocompletion
2.1.1 Installation – Environment auto-matched insertion (en-
ter begin, also get end)
Get Eclipse (Classic version is most suitable)
– Delimiter auto-matched insertion
from http://www.eclipse.org/downloads/. Be
sure to get the build for your platform (Win- – Command completion
dows/Mac/Linux). You can get the bleed- – Converts " to ‘‘ or ’’ automatically
ing edge from http://download.eclipse.org/
eclipse/downloads/; I recommend a stable build – Converts ... to \ldots automatically
of an upcoming version to get new features with
• Similar to delimiter insertion is delimiter pair-
the stability that you need.
ing. A cursor after a delimiter highlights its
Unpack anywhere and run “eclipse.” Click
pair.
“Help”→”Install New Software.” In the box “Work
with:” enter http://texlipse.sourceforge.net • Cite and ref lists (remembers your labels so
for the release build or http://texlipse.sf.net/ you don’t have to)
daily for the bleeding edge (I know it has some
good features). You will have to give it some • Cite and ref pairing (cursor in ref highlights
name; anything will do. Then click the check-box the label, etc.)
for Texlipse and follow the install prompts. After
restarting you will have TeXlipse fully installed. • Tab exiting
• Multiline commenting
2.1.2 Setup
In “Windows”→“Preferences” under • Build management (Helps run builders to
“TeXlipse”→“Builder settings” set the bin cross-reference)
2
2.1.4 Use To use, find some article’s page online, say
http://journals.cambridge.org/action/
To use TEXlipse you first create a project. Once
displayAbstract?fromPage=online&aid=
this is going all you need to do to compile is save
5888920 then in the url bar click on the new
the source document. Thats right, it automatically
“Save to Zotero” button (looks like a page) next
compiles after every save. Sometimes if you change
to the usual “bookmark” star. This saves the
section numbers etc. you might want to save and
information of the article to Zotero.
then do “Project”→“Clean.”
Open Zotero by clicking the icon in the lower
For further functionality:
right corner in firefox. You can export saved entries
• Many of the features are configured in the pref- by right-clicking “My Library”→“Export Library.”
erences menu seen above. Pick “Bibtex” and the save in the same directory
as your .tex files; it should have a .bib extension.
• To view the complied file hit Ctrl+4 to view
with the viewer set in preferences or double
click on the file in the “Project Explorer” to 2.3 BibTEX
use the system default.
BibTEX is an extension to LATEX that aids typeset-
• Be sure to initially add extra views ting your bibliography.
“Window”→“Show view”→”Other and
under Texlipse you can get the Table and Full 2.3.1 General Use
Outline.
To use BibTEX you create a .bib file with bibli-
• Autocompletion and lists are triggered by
ographic information in a specific format. This
pressing Ctrl+Space.
format is complicated and specific; since there are
• Tab exiting is indicated by a green cursor after so many reference management programs that can
the delimited block you are in. Hitting tab will format it for you, I recommend these. The doc-
bring your cursor to that point (i.e., outside umentation can be found at http://www.bibtex.
parenthesis or braces). org/.
The most important piece of information that
• Delimiter matching should be automatic, but must be in the entries is the name key. This is
be careful when doing complicated nesting as your method of referencing that particular refer-
sometimes this gets it confused. ence item. While you are typing your document
now all you need to do to create a citation is en-
• Tasks are triggered by adding the comment
ter \cite{key} and BibTEX automatically adds a
%TODO message in your source and your mes-
number and will add this reference to the bibliog-
sage will appear in the Tasks tab.
raphy section.
• Multiline comment by selecting what you Finally we need to include the bibliography at
want to (un)comment and hit Ctrl+5 (think the end. Just before the \end{document} com-
Ctrl+%) and it will put(remove) a comment mand we need to do two things we need to give a
symbol (%) in front of each highlighted line. bibliography style which acts — much like a doc-
ument class acts for the paper — in defining how
the bibliography should look. For a basic bibli-
2.2 Zotero
ography we can do \bibliographystyle{plain}.
Zotero is a free firefox extension installed (inside Then we just need to tell it what our .bib file is
firefox!) through “Tools”→“Add-ons.” It saves, named with \bibliography{mybiblio} if your file
formats and exports citations from inside firefox! is called mybiblio.bib.
3
2.3.2 As Part of Toolchain program similar to Origin (free for Linux users
and free source code for other platforms but you
My biggest complaint was that since Zotero is so
have to compile yourself). There are several other
“hands-off” that you don’t know what the key
programs like this one, however this seems to be
for each item is! It is (usually!): <Author’s
the most advanced.
Last Name> <Title’s First Word> <Publication
Once the plot is created it can be exported as
Year>. This is why the toolchain concept is im-
an SVG (or other formats). It is not foolproof,
portant; since TEXlipse has cite listing built in, the
sometimes I have to clean it up in Inkscape after
problem of knowing the cite key doesn’t really mat-
the export.
ter anymore, simply find it in the drop-down menu
with “Crtl+Space.” It also allows export to TikZ (see section 2.4.5)
by exporting to .tex. However I have found this
to be even less relible than SVG export, though it
2.4 Creating Graphics would give a starting point for using TikZ.
I use several programs for creating figures, some of
them are included here. 2.4.3 Mathematica Export
2.4.1 SVG Images / Inkscape You can also export as SVG or other image formats
from Mathematica. For example, the following will
SVG is a type of vector image format. This means export a 3rd order Super-Gaussian example figure
that rather than storing pixel information the im- as both an svg and png in the same directory as
age is comprised of vector that form the image. the notebook.
Vector images are preferred when making a publi-
cation or presentation for several reasons. F [ n , x ] : =Exp[−x ˆ ( 2 n ) ] ;
• The images scale without loss of resolution (∗ For e x p o r t i n g as s v g ∗)
• They can be easily modified to make correc-
tions or to reuse for future projects Export [
StringJoin [
• With a little work one can make a series of NotebookDirectory [ ] ,
images used for an incremental presentation ”SG3 . svg ”
However, their biggest problem is that they cannot ],
be used in LATEX directly. They must eventually Plot [
be converted to some other format for inclusion. F [ 3 , x ] , {x , −3, 3 } ,
Inkscape (http://www.inkscape.org/) is a nice PlotStyle −> {Black , Thick } ,
program for creating and editing SVG images. It is Axes −> False ,
available for all platforms for free and can export F i l l i n g −> Bottom ,
to .png and .pdf (which is also a vector format) for F i l l i n g S t y l e −> Cyan
use in your documents. It does have some rendering ]
capabilities (simple functions etc.) but for making ]
plots of data I often generate an initial SVG from
another program and then edit it in Inksape. (∗ Or f o r png ∗)
Export [
2.4.2 QtiPlot
StringJoin [
QtiPlot (http://soft.proindependent.com/ NotebookDirectory [ ] ,
qtiplot.html) is a semi-free scientific plotting ”SG3 . png”
4
], want. Therefore I will walk you through a simple
Plot [ presentation.
F [ 3 , x ] , {x , −3, 3 } ,
PlotStyle −> {Black , Thick } , 3.1.1 Themes
Axes −> False ,
F i l l i n g −> Bottom , First you pick your theme. I like the Madrid theme
F i l l i n g S t y l e −> Cyan with with secheader option which shows the cur-
], rent section in the header. I also like the color
ImageSize −> 7 0 0 , theme ostrich but it is not included with the typ-
ImageResolution −> 350 ical LATEX-Beamer distribution so I will leave it
] commented. It was actually developed by some
folks at UIC, so it is easy for us to use. Get it
Again, I then go back to Inkscape to do the finer at http://alcazar.sisl.rites.uic.edu/wiki/
points. view/Main/SISLBeamerColorThemes. It was a co-
incidence, I really like
2.4.4 GIMP \documentclass{ beamer }
\ usetheme [ s e c h e a d e r ] { Madrid }
GIMP (http://www.gimp.org/) is a free image
%\ u s e c o l o r t h e m e { o s t r i c h }
manipulation program comparable to Photoshop.
\ s e t b e a m e r c o v e r e d { t r a n s p a r e n t =50}
I use it sparingly as it is very complicated. I do
find it very useful for the final image sizing and Themes are a nice feature as you can change it
resizing as needed, as well as cropping etc. quickly and easily if you change your mind. I threw
in an additional command, we will see it’s use later.
2.4.5 TikZ Package
3.1.2 Title Material
I haven’t tried using TikZ directly yet, however it
is this package that gives Beamer its good looks. Similar to the title material in an article Beamer
Basically it is a method of drawing using LATEX has macros to make a title slide.
commands directly inside your source. This native \ t i t l e [ Short T i t l e ]
method saves the hassle of having to get your figure {Much Longer T i t l e f o r Front Page }
to meld correctly with your paper, however it is \author{ J o e l B e r g e r }
not a graphical drawing program so you will have \ i n s t i t u t e {Venue o r Employer }
to work on your figure’s source as you do for your \date {\today}
text.
Find out more at http://sourceforge.net/ \ begin{ document }
projects/pgf/. A good tutorial is available
from the PracTeX journal at http://www.tug. \ begin{ frame }
org/pracjourn/2007-1/mertz/ and examples at \ titlepage
http://www.texample.net/tikz/. \end{ frame }
3 Beamer 3.1.3 Frames
Beamer makes slides called frames.
3.1 Basics
\ begin{ frame }{ T i t l e o f Frame}
Beamer is highly documented, however the manual Content o f frame
is very long, and it can be hard to find what you \end{ frame }
5
Since it creates a PDF as its output it cannot \end{ b l o c k }
have incremental slides as Powerpoint does. What }
it does instead is create a series of PDF pages that \end{ frame }
when viewed sequentially accomplishes the same
task. We do the incrementing by adding markers
such as <2-> meaning show from increment 2 and 3.1.5 Columns and Graphics
on. Maybe you want to have a picture on one side and
\ begin{ frame }{ I l i k e l i s t s } a list on the other. Beamer also has columning
I l i k e l i s t s because mechanisms that are more powerful than the simple
\ begin{ i t e m i z e } twocolumn article. First you need a columns envi-
\item They keep me o r g a n i z e d ronment and then you need column environments
\item<2−> I t ’ s fun t o check that have their width as options. I recommend
o f f completed i t e m s using relative sizing and not having the columns
\item<3−> I ’m a geek overlap. For graphics use the same commands you
\end{ i t e m i z e } are used to, you dont need a figure environment
\end{ frame } but sometimes it helps. Also the linewidth is re-
defined inside the column. In this example look at
Since we set the transparency above, items that are the width I define for the graphic.
not yet uncovered are present but 50% transparent.
There are other methods to accomplish increment- \ begin{ frame }
ing this but that is the robust one. \ begin{ columns }
For items that cannot take a simple marker or \ begin { column } { 0 . 4 9 \ linewidth }
to do specific things, there are commands like: \ begin{ i t e m i z e }
\uncover<2->{} (much like the markers above), \item One
\visible<2->{} (hidden even if transparency is \item<2−> Two
set) and \only<2->{} which is not typeset at all \item<3−> Three
until increment 2. Give your text or commands as \end{ i t e m i z e }
arguements to these commands and see what hap- \end{ column }
pens. \ begin { column } { 0 . 4 9 \ linewidth }
\ begin{ f i g u r e }
3.1.4 Blocks \ centering
\ includegraphics
Beamer contains a special mechanism to create [ width =0.95\ linewidth ]
boxes (for emphasis or organization, etc.) called {
blocks. These blocks may have a title and are au- image . png
tomatically sized to fit their contents. In fact the }
whole thing can be brought in later for even more \end{ f i g u r e }
emphasis. For example \end{ column }
\ begin{ frame } \end{ columns }
{My Experiment and R e s u l t s } \end{ frame }
My e x p e r i m e n t and how i t works .
More i n f o , b l a h b l a h b l a h .
3.1.6 Sectioning and Outline Pages
\ only <2−>{
\ begin { b l o c k }{My R e s u l t s } section and subsection commands are given out-
This i s t h e s t u f f t h a t side of the frames. Once this is done you can use a
I want you t o s e e ! page (perhaps right after the title page):
6
\ section { I n t r o d u c t i o n } the presentation but without incrementing slides
\ begin{ frame } etc., and “article” for lecture notes. There are a few
\ tableofcontents other modes that are less common but I won’t talk
\end{ frame } about them. There are also the umbrella “modes:”
\ section {On with t h e t a l k } (mode-like commands that include more than one
... mode) “presentation” which is any mode except
“article” and “all.”
Maybe you want to remind your audience where
Using modes allows us to specify which com-
you are in the talk. Certain themes have out-
mands one wants in different forms of the docu-
lines built in; remember I added secheader to my
ment. I will give specific examples later. Many
theme. Additionally you can tell Beamer to revisit
commands can take mode options but the most
the outline at each new (sub)section and even high-
useful is \only<‘‘mode’’> such as
light were you are! This is done outside of a frame
and sometime just before when you want to begin \ section<p r e s e n t a t i o n >{ I n t r o d u c t i o n }
this behavior (I always do it after the introduction
section command and initial outline page; say just \ begin{ frame }
before the second section)
Some t e x t shown i n a l l modes .
\ AtBeginSection {
\ begin{ frame }{ O u t l i n e }
\ only<a r t i c l e >{
\ tableofcontents
Text not shown on p r e s e n t a t i o n s .
[ currentsection ]
}
\end{ frame }
\end{ frame }
}
%and maybe you a l s o want One final note is that I find that sometimes when
\ AtBeginSubsection { switching between modes I have to recompile from
\ begin{ frame }{ O u t l i n e } scratch (remove aux files etc.) and run the compil-
\ tableofcontents [ ers the full number of times or else a strange output
currentsection , may be obtained.
currentsubsection
] 3.2.1 Beamer
\end{ frame }
} We have already seen how to invoke beamer,
however we may want to include the option
ignorenonframetext to the documentclass in case
3.2 Additional Documents we want to add additional text between slides in
the article.
Beamer also allows you to create supporting docu-
ments. Sometimes it is useful to have handouts of
your talk to give to the audience, or perhaps you 3.2.2 Handout
need lecture notes for your students. Beamer can Handouts are created by passing the handout op-
produce these all from the same (though possibly tion (possibly still while ignoring the non-frame
modified) source code. text) to the documentclass. Sometimes a few
tweaks can be useful. I like adding in the preamble
Modes
\mode<handout >{
Beamer now operates in several “modes” which are: \usepackage{ p g f p a g e s }
“beamer” for the main presentation “handout” for \ p g f p a g e s u s e l a y o u t {4 on 1}
7
[ b o r d e r s h r i n k =3mm] Overview mode displays all the slides at one time
\ s e t b e a m e r c o l o r { background canvas } on a grid, then one can click on a frame to go to
{bg=b l a c k ! 5 } that point in the presentation. This is especially
} useful during Q&A after the talk for going to the
frame in question while still looking professional
to cause there to be 4 slides per page in handout
and remaining in presentation mode (as opposed
mode. One may also want to specify a different
to exiting to the user interface in powerpoint, or
theme or color scheme as well.
worse “clicking back”).
As I said above, Impress!ve is cross-platform
3.2.3 Article (Lecture Notes) (written in python). In Linux (with python in-
Article mode is different than other modes. The stalled) the script itself is all that’s needed. Mac
documentclass is not beamer but article, and will also work, but python may have to be in-
then load the package beamerarticle. Once this is stalled or upgraded manually (as per the docu-
done the beamerness of the document is ignored. I mentation page on the site). For Windows, where
find that this mode needs the most tweaking from python is probably not installed (particularly if we
the original beamer source. One can write addi- are using a shared conference presentation laptop),
tional text between frames (see above) for the flow the downloaded “.zip” file contains a stand-alone,
to be right and only do certain commands in this working python as well as the script! This way Im-
mode (i.e. I only use the caption in figures in article press!ve can be run from the desktop or even your
mode). USB stick on any windows computer.
3.3 Impress!ve 3.4 Posters with Beamer
Beamer creates incremental frames by having se- Beamer has presented a window into the colorful
quential pdf pages. This works just fine but and shapely side of LATEX that is in large part
doesn’t have the fancy presentation style that a due to the pgf package that underlies it as well
powerpoint might have. To reclaim some of this as TikZ. If you imagine hard enough you might
glory I use the presentation program Impress!ve envision a large Beamer slide that is used as a
(http://impressive.sourceforge.net/), rather poster (not unlike how most people make posters
than acrobat or other PDF viewer. - powerpoint). This concept has been cotified
Impress!ve has several nice features: into the (aptly named) package beamerposter
(http://www-i6.informatik.rwth-aachen.de/
• Transition effects ~dreuw/latexbeamerposter.php).
A poster is made with some header material (see
• Overview mode the examples as well as the website). Themes are
• Spotlight or “spot-box” effect the same though a few alterations or new styles
might be useful (again see the website). The ma-
• Cross-platform jority of the poster is then inside one frame envi-
ronment, with the content then in column and if
The transitions (and other properties) can be desired block environments.
controlled on a per-page basis by creating a “.info”
file next to the “.pdf” file. I have created
a perl script called “makebeamerinfo” (http:// 4 UICThesi
code.google.com/p/makebeamerinfo/) that cre-
ates this file for showing a clean but still interesting Did you know that UIC has a document class
presentation. for your thesis? The Math Department hosts it
8
(and presumably maintains it). Files and explaina-
tion are available at http://www.math.uic.edu/
graduate/current/uicthesi. My guess is that
the name is what it is due to the old DOS/Win-
dows 8-character filename limit.
The commands are simple enough. Based on
the article style, the only real additions (besides
the formatting) are some extra commands for sec-
tioning (i.e., \dedication). Reading throught the
pdf of the UICThesi manual (uictman.pdf) will not
only help you with UICThesi but also with the for-
matting and contents of a thesis for a Ph.D. here
at UIC. It also contains some basic tutorial infor-
mation for using LATEX most of which is review
for people at this level. Notice also that the uict-
man.pdf is itself formatted using UICThesi as a
thesis (containing all the necessary elements).