Sie sind auf Seite 1von 17

What is Latex

Tables and Graphics


Presentations with Latex
Cross-References
Conclusion
Latex Basics
What is Latex? How can I use it to write papers and create
presentations?
Clair and Shanthi
Department of Agricultural and Resource Economics
University of California, Berkeley
December 8, 2008
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Latex - An Overview
Tex is pronounced tech as in technology
Latex is a typesetting system that helps to prepare documents
Latex can be used to write papers with
Tables
Formulas
Graphics...
...and to make presentations like this one
Latex can also be used to manage references
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Benets of Latex
Latex relieves you of many formatting decisions.
Latex will gure out where tables, graphics, etc. t best. You
can control whether they are embedded in the text or at the
end.
Once you choose a document class (e.g., article), Latex has
built-in defaults for font, spacing, etc. You can change these
defaults if you want.
Latex enables you to refer to tables, graphs, etc. outside of
your document, so they are automatically updated in your
Latex document when you change them
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
How Can I Get Latex?
Latex is available for
PC
Mac
Unix
Latex is share-ware (free!)
Google latex pc, latex mac etc., choose a suite of programs
and follow the instructions
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Types of Latex Editors
Basic (like Matlab - its hard, but you know whats under the hood!)
Write code in Word, Notepad, etc.
Compile code (turn le into pdf) using command prompt window
Slightly more fancy/easier
Software like BearTex (Mac)
Write code in this software, click on a button to turn it into pdf
Includes GUI with Greek letters, etc.
Our favorite: Lyx (like Stata - its easier, but you dont know whats
under the hood)
Closest to a word processor
Write formulas in code, but software balances parentheses, shows
you a preview of formula, etc.
Format text with various word-processor-like buttons (e.g. to make
text bold, indent pargraphs, etc.)
Alternatives ($$$):
Scientic Workplace (PC), Scientic Assistant (Mac)
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Packages
At the beginning of your Latex document, you need to specify
which packages to use
Once you specify a document class in Lyx, it automatically
knows many of the packages youll need
You can add more packages or customized instructions on
margins, etc. under the Lyx preamble
Packages include things like graphics (allows you to insert
graphics), rotating (allows you to insert sideways tables),
amsmath (allows you to insert additional math symbols)
You can download standardized formatting packages that
mimic the style (including bibliography) of various economics
journals (http://www.ctan.org/tex-
archive/biblio/bibtex/contrib/economic/)
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Environments
Text (default)
Can designate sections, paragraphs, bullet points, quotes, etc.
You dont have to keep track of section numbering
Can create a Table of Contents automatically
Math
In-line formulas allow you to embed a formula in the text. For
example, E[|X] = 0
Display formulas allow you to put a formula on a separate line
X N(0,
2
)
Special environments
Equation Array lines up your = signs when writing proofs,
etc.
Multiline allows your formula to wrap around
Tables and graphics
Evil red text (in Lyx) allows you to insert Latex code directly
into your document
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Tables from Excel
Tables are a huge pain to write yourself (Take it from us -
weve tried!)
Download xl2latex, which allows you to import tables from
Excel into a Latex editor
In Lyx, insert the table into an ERT box
Formatting can still be tricky
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Tables from Stata
Even more directly, you can use two sets of commands in
Stata to export tables into Latex
est2vec and est2tex
eststo and esttab which can also output to .tab, .csv, and
other formats
These commands create a Latex (.tex) document with your
table. In your main Latex document, all you have to do is refer
to the .tex le with your table using the \input{} command.
These are beautifully formatted with no eort on your part!
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Graphics (1)
Graphics from other programs
Save graphics as .eps les
Open a graphics environment, and put in a reference to the
graph
You dont have to update the graph in your document every
time you change it, as long as it has the same name
You can change the size or position of the graph, add captions,
etc. in Latex
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Graphics (2)
Graphics directly in Latex
Use the picture environment
Make lines, vectors, and curves (the qbezier command)
Get basic info at http://www-
h.eng.cam.ac.uk/help/tpl/textprocessing/teT
E
X/latex/latex2e-
html/ltx-43.html
Dont reinvent the wheel; get someone elses graphics and
modify them. You can use the code on the following page, for
example (thanks to Robert S. for the original code).
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Graphics (3)
6
w
P
1
M
MPL
M
P
0
M
MPL
M
P
0
L
MPL
L

w
L
M
L
F
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Tex2PPT
Allows you to embed parts of your Latex document directly
into your PPT slides
Implemented by inserting a text box in PPT and pasting the
Latex code into it
Can change size of formulas
Allows you to run your slideshow as a .ppt le (including
animation, etc.) or as a pdf le (no animation)
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Beamer
Many people on the job market this year used Beamer
Beamer is a document class in Latex
More in the spirit of Latex than Tex2PPT
Default formatting, etc. built in
Allows you to write Latex code and turn it into a pdf
Can copy/paste formulas, graphics, etc. from another Latex
document (e.g., the related paper)
Allows text (e.g., bullet points) to be displayed sequentially
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Referencing Sections, Tables, etc.
Latex automatically numbers your sections, tables, graphics,
etc.
You can add references to equations manually (you dont have
to number them, just name them)
You can insert references to any of these things
References automatically reect changes in numbering,
position, etc.
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Bibliography
BibTex is a reference manager that is compatible with Latex
Software includes JabRef (PC), BibDesk (Mac)
Enter potential references into the software (can keep entire
database of references here)
Can refer to one or more BibTex databases in your Latex
document
Latex automatically generates and numbers bibliography
Style les (.bst les) allow you to change the citation and
bibliography formats according to standard journal
requirements (http://www.ctan.org/tex-
archive/biblio/bibtex/contrib/economic/)
Clair and Shanthi Latex Basics
What is Latex
Tables and Graphics
Presentations with Latex
Cross-References
Conclusion
Are You Convinced Yet?
Latex articles and presentations look professional
They are actually easier to produce and manage than Word or
PPT les, once you learn how to use them
Caveat: The one drawback is that students may be ahead of
professors in technology adoption...if your professor wants to
edit your paper in Word, then you need to (a) write your paper
in Word or (b) show them this slideshow!
Clair and Shanthi Latex Basics

Das könnte Ihnen auch gefallen