Difference between revisions of "LaTeX basics"

From UCB Math Wiki
Jump to: navigation, search
(Editors)
m (fixed emdash)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
LaTeX is the standard method of typesetting mathematics. It comes on all the department's computers. See [[LaTeX Install|here]] for instructions on installing it on your own computer. LaTeX's input can be edited in any text editor, but you may wish to use a [[Text Editor|specialized text editor]].
 +
 
==Learning LaTeX==
 
==Learning LaTeX==
One very good idea is to get a LaTeX file from a more experienced user so that you can see their tricks in action.  For example, you could download the source for my papers from [http://math.berkeley.edu/~bwebste my website].  More generally, you can get the source of any paper on [http://front.math.ucdavis.edu the arXiv],  which should lead to a fairly inexhaustable source of LaTeX tricks beyond the standard tutorials.
+
[http://www.math.harvard.edu/texman/ "An Introduction to LaTeX"] and [http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/ "Getting Started with LaTeX"] are good introductions.
  
==Editors==
+
[http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf "The Not-so-short introduction to LaTeX2e"] is very complete, and also written in a very easy to understand fashionIt's probably more useful as a reference than anything else—I don't recommend reading it cover-to-cover.
Learn to use a specialized LaTeX editorFor the department computers, probably the best choice is Emacs with AucTeX.
 
  
[http://doc.kom.aau.dk/reference_cards/ Here] are some very useful reference cards for Emacs and AucTeX commands.
+
[http://www-math.mit.edu/~psh/exam/examdoc.pdf "Using the exam document class"] is a very readable introduction to a very useful document class.
  
To use AucTeX (and RefTeX), edit your .emacs file (you may not know it's there, but it is), for example with the shell command <pre>emacs ~/.emacs &</pre>
+
Once you've learned the basics, a good idea is to get a LaTeX file from a more experienced user so that you can see their tricks in action, and just cut and paste.  Even experienced LaTeX users do this from their own papers from time to time.  For example, you can get the source of any paper on [http://front.math.ucdavis.edu the arXiv], which should lead to a fairly inexhaustible source of LaTeX tricks beyond the standard tutorials.
and insert the lines
 
<pre>(require 'tex-site)
 
(setq reftex-plug-into-AUCTeX t)
 
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
 
</pre>
 
After this, AucTeX will automatically start up any time you use a TeX document.
 
  
For your home computer, you may need to download these packages.  On a Mac, this can be done with [http://fink.sourceforge.net/ Fink].
+
If you want to use the exam package, you could use [http://math.berkeley.edu/~eep/teaching/M54sp06PF.tex this practice final].
  
Other editor options include:
+
==Diagrams==
*[http://www.winedt.com WinEdt] for Windows,
+
The most popular package for drawing diagrams is XYpic.  Drawing roughly rectilinear commutative diagrams is relatively easy (see the xyguide), but in fact, there is a lot more you can do with this package if you're willing to go through the steeper learning curve and learn xypic proper.  Aaron Lauda has a lot of useful examples in [http://www.dpmms.cam.ac.uk/~al366/xytutorial.html his tutorial].  
*[http://kile.sourceforge.net/ Kile] for KDE,
+
 
*[http://www.uoregon.edu/~koch/texshop/ TexShop] for Mac OS.
+
Other options include the <tt>amscd</tt> and <tt>diagrams</tt> packages which are less flexible, but easier for simpler commutative diagrams.
  
 
==Bibliographies==
 
==Bibliographies==
 
Learn [http://cmtw.harvard.edu/Documentation/TeX/Bibtex/Example.html how to use BibTeX].  I promise you won't regret it later.  Remember that you can get BibTeX citations from from [http://ams.rice.edu MathSciNet] or [http://front.math.ucdavis.edu the Front].  Somewhat obnoxiously, the standard BibTeX styles won't produce a citation to the arXiv, so you'll want an special BibTeX style.  I use [/~bwebste/halpha.bst halpha.bst].
 
Learn [http://cmtw.harvard.edu/Documentation/TeX/Bibtex/Example.html how to use BibTeX].  I promise you won't regret it later.  Remember that you can get BibTeX citations from from [http://ams.rice.edu MathSciNet] or [http://front.math.ucdavis.edu the Front].  Somewhat obnoxiously, the standard BibTeX styles won't produce a citation to the arXiv, so you'll want an special BibTeX style.  I use [/~bwebste/halpha.bst halpha.bst].
 +
 +
If ever want access to the LaTeX version of the bibliography that BibTeX has created, it's in the file *.bbl.  If you submit a paper with BibTeX'ed bibliography to the arXiv, you should include the *.bbl file, NOT the *.bib.

Latest revision as of 23:41, 13 July 2009

LaTeX is the standard method of typesetting mathematics. It comes on all the department's computers. See here for instructions on installing it on your own computer. LaTeX's input can be edited in any text editor, but you may wish to use a specialized text editor.

Learning LaTeX

"An Introduction to LaTeX" and "Getting Started with LaTeX" are good introductions.

"The Not-so-short introduction to LaTeX2e" is very complete, and also written in a very easy to understand fashion. It's probably more useful as a reference than anything else—I don't recommend reading it cover-to-cover.

"Using the exam document class" is a very readable introduction to a very useful document class.

Once you've learned the basics, a good idea is to get a LaTeX file from a more experienced user so that you can see their tricks in action, and just cut and paste. Even experienced LaTeX users do this from their own papers from time to time. For example, you can get the source of any paper on the arXiv, which should lead to a fairly inexhaustible source of LaTeX tricks beyond the standard tutorials.

If you want to use the exam package, you could use this practice final.

Diagrams

The most popular package for drawing diagrams is XYpic. Drawing roughly rectilinear commutative diagrams is relatively easy (see the xyguide), but in fact, there is a lot more you can do with this package if you're willing to go through the steeper learning curve and learn xypic proper. Aaron Lauda has a lot of useful examples in his tutorial.

Other options include the amscd and diagrams packages which are less flexible, but easier for simpler commutative diagrams.

Bibliographies

Learn how to use BibTeX. I promise you won't regret it later. Remember that you can get BibTeX citations from from MathSciNet or the Front. Somewhat obnoxiously, the standard BibTeX styles won't produce a citation to the arXiv, so you'll want an special BibTeX style. I use halpha.bst.

If ever want access to the LaTeX version of the bibliography that BibTeX has created, it's in the file *.bbl. If you submit a paper with BibTeX'ed bibliography to the arXiv, you should include the *.bbl file, NOT the *.bib.