Difference between revisions of "LaTeX"

From Christoph's Personal Wiki
Jump to: navigation, search
(Started article)
 
(Examples)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
'''L<sup>A</sup>T<sub><big>E</big></sub>X''', written as '''LaTeX''' in plain text, is a document preparation system for the [[TeX]] typesetting program.  
 
'''L<sup>A</sup>T<sub><big>E</big></sub>X''', written as '''LaTeX''' in plain text, is a document preparation system for the [[TeX]] typesetting program.  
  
It offers programmable desktop publishing features and extensive facilities for automating most aspects of typesetting and desktop publishing, including numbering and cross-referencing, tables and figures, page layout, bibliographies, and much more. LaTeX was originally written in 1984 by Leslie Lamport and has become the dominant method for using [[TeX]]&mdash;few people write in plain TeX anymore. The current version is LaTeX2&epsilon;.
+
== Examples ==
 +
===A base document===
 +
''Note: This is a useful starting point for a large document or book.''
 +
<pre>
 +
\documentclass[11pt,a4paper]{book}
  
==The typesetting system==
+
\title{A Long Master Thesis}
LaTeX is based on the idea that ''authors'' should be able to concentrate on ''writing'' within the logical structure of their document, rather than spending their time on the details of ''formatting''. It encourages the separation of formatting from content, whilst still allowing manual typesetting adjustments where needed. By keeping the formatting details in a separate file from the text, it is often regarded as superior to [[word processor]]s and most other desktop publishing systems, which allow trivially easy visual layout changes but tend to intertwine content and form so tightly that consistency and automation are often difficult. LaTeX also provides great flexibility in formatting while maintaining the identity of structure, which purely structural systems like [[SGML]] and [[XML]] do not directly address.
+
  
LaTeX can be arbitrarily extended by using the underlying [[macro language]] for developing custom formats. For example, there are numerous commercial implementations of the whole TeX system (which includes LaTeX), and vendors may offer extra features like phone support and additional [[typeface]]s. [[LyX]] is a [[Free software|free]] visual document processor that uses LaTeX for a back-end. [[TeXmacs]] is a [[Free software|free]], [[WYSIWYG]] editor with similar functionalities as LaTeX, but a different typesetting engine.
+
\author{Eivind Uggedal}
  
A number of popular commercial [[Desktop_publishing|DTP]] systems use modified versions of the original TeX typesetting engine.
+
\begin{document}
The recent rise in popularity of [[XML]] systems and the demand for large-scale [[batch production]] of publication-quality typesetting from such sources has seen a steady increase in the use of LaTeX.
+
  
The example below shows an example of a LaTeX input (left) and output (right):
+
  \frontmatter
{|
+
    \maketitle
|+style="text-align: left" |
+
    \tableofcontents
| style="margin:2em; padding: 1em; width:50%" |
+
    \listoffigures
<code>
+
    \listoftables
\documentclass[12pt]{article} <br>
+
    \include{acknowledgements}
\title{\LaTeX} <br>
+
\date{} <br>
+
\begin{document} <br>
+
\maketitle \LaTeX{} is a document preparation system for the \TeX{}
+
typesetting program. It offers programmable desktop publishing
+
features and extensive facilities for automating most aspects of
+
typesetting and desktop publishing, including numbering and
+
cross-referencing, tables and figures, page layout, bibliographies,
+
and much more. \LaTeX{} was originally written in 1984 by Leslie
+
Lamport and has become the dominant method for using \TeX; few
+
people write in plain \TeX{} anymore. The current version is
+
\LaTeXe. <br>
+
\newline <br>
+
% This is a comment, it is not shown in the final output. <br>
+
% The following shows a little of the typesetting power of LaTeX <br>
+
\begin{eqnarray} <br>
+
E &=& mc^2                              \\ <br>
+
m &=& \frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}} <br>
+
\end{eqnarray} <br>
+
\end{document} <br>
+
</code>
+
| [http://upload.wikimedia.org/wikipedia/en/7/7c/LaTeX_Output.png]
+
|}
+
  
[http://sciencesoft.at/index.jsp?link=latex&lang=en&wiki=1 Online LaTex], which uses this example.
+
  \mainmatter
 +
    \include{introduction}
 +
    \include{background}
 +
    \include{methodology}
 +
    \include{implementation}
 +
    \include{analysis}
 +
    \include{discussion}
 +
    \include{conclusion}
  
==Community==
+
  \appendix
 +
    \include{questionnaire}
 +
    \include{source.code}
  
LaTeX was originally most commonly used by mathematicians and scientists, amongst whom it remains the favored tool for writing scientific paper, preprints, and books. Because of the underlying TeX system, originally developed for documents with mathematics, laying out [[mathematical expression]]s is considered to be easier, and the resulting typesetting of higher quality, than any competing document-processing systems. Many scientific journals and other publishers provide free LaTeX packages which implement their "in-house" typesetting styles.
+
  \backmatter
 +
    \bibliography{bib.items}
  
The popularity of LaTeX in the technical and academic communities is perhaps partly due to its early availability on [[Unix]] systems, and the comparative unavailability of competing word processors on those platforms until recently. But from an early stage LaTeX was available on a wider range of hardware and software than any other program, and versions are now available for almost any system from PDAs to desktop PCs to supercomputers.
+
\end{document}
 +
</pre>
  
LaTeX is less popular than mainstream desktop publishing software outside the technical communities for several reasons. It is regarded as hard to learn for people with no previous experience of [[markup language]]s. Although it is very easy to customise the appearance of articles, books, and reports, using only a handful of instructions, it remains basically a typesetter for automating document production, not a manual page design program, so performing complex visual layouts incorporating multiple images is difficult.  Another barrier to usage for many is the asynchronous interface used in most free versions, where editing is done in a different window from the typeset display. Inverse search can be used to bridge this problem partially. Several commercial implementations, however, use a synchronous typographic display like other desktop publishing (DTP) systems (as does the non-commercial and open source [[LyX]]).  Alternatively, GNU [[TeXmacs]] is a free WYSIWYG editor which offers features similar to LaTeX, but is based on
+
=== Document (basics) ===
a different typesetting engine.
+
==== Article with text only ====
 +
<pre>
 +
\documentclass{article}
  
==Licensing issues==
+
\begin{document}
LaTeX is [[free software]]. It has a peculiar license called [[LaTeX Project Public License|LPPL]], not compatible with the [[GNU General Public License]], that allows redistribution and modification, but requires that modified files carry a modified filename.
+
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis dapibus.
This ensures that files that depend on other files will produce the expected behavior and avoids problems similar to [[DLL hell]]. A new version of the LPPL that will be compatible with the GPL is in the works.
+
In hac habitasse platea dictumst. Aenean eu velit. Nullam eros. Vestibulum
 +
scelerisque tristique nisl. Maecenas in tortor sit amet justo rhoncus
 +
blandit. Cras eget ipsum bibendum massa ultricies sodales. Ut est arcu,  
 +
elementum et, sagittis eget, pellentesque at, sem. Nam tincidunt. Curabitur
 +
urna arcu, ultrices nec, blandit ullamcorper, hendrerit id, ante. In
 +
tincidunt nonummy orci. Quisque eget sem. Ut aliquam augue eu libero. Sed
 +
turpis dui, euismod vel, ultricies sed, porta eget, lacus.
 +
\end{document}
 +
</pre>
 +
==== Definition of macros for later use in document ====
 +
<pre>
 +
\documentclass{article}
 +
\usepackage{german}
  
==Frontends==
+
% The example macro generates the marker for an example inside a document
Because LaTeX markup code can be hard to remember and/or time consuming to learn, there are a few front ends to help:
+
\def\example{\refstepcounter{subsection}
 +
\paragraph{\underline{$\rhd$\ Example\ \thesubsection}}}
  
*[[Kile]]: IDE designed mainly for [[KDE]] ([http://kile.sourceforge.net/ homepage]).
+
\begin{document}
*[[LEd]]: A free environment for rapid TeX/LaTeX document development under MS Windows ([http://www.latexeditor.org homepage]).
+
*[[LyX]]: [[WYSIWYM]] (What you see is what you mean) IDE ([http://www.lyx.org/ homepage]).
+
*[[AUCTeX]]: an extensible package for writing and formatting TeX/LaTeX files in [[GNU Emacs]] and [[XEmacs]] ([http://www.gnu.org/software/auctex/ homepage])
+
*[[Scientific Letter]]: Commerce mail software with export to TeX/LaTeX ([http://www.sciletter.com/ homepage]).
+
*[[Texmaker]]: Free cross-platform LaTeX editor. Runs on Windows, Mac OS X and Unix (GNU/Linux binary). Is released under the GPL license ([http://www.xm1math.net/texmaker/index.html homepage]).
+
*[[TeXnicCenter]]: IDE designed for MS Windows users under GPL ([http://www.toolscenter.org/ homepage]).
+
*[[TeXShop]]: A free front end for [[Mac OS X]], with editor and output window ([http://www.uoregon.edu/~koch/texshop/texshop.html homepage]).
+
*[[WebTex]]: A free [[MiKTeX]]/[[Common Gateway Interface|CGI]] driven web front end ([http://dev.baywifi.com/latex/ homepage]).
+
*[[WinEdt]]: Shareware IDE for Windows 9x/NT4.0/2000/XP ([http://www.winedt.com/ homepage]).
+
*[[WinShell]]: Freeware IDE for Windows 9x/NT4.0/2000/XP ([http://www.winshell.de/ homepage]).
+
  
==See also==
+
To generate the header for an example inside your document you now
* [[TeXmacs]] A GPL, WYSIWYG, structured editor with similar features as LaTeX, but a different typesetting engine (with TeX/LaTeX import/export).
+
simply need to type:
* [http://meta.wikimedia.org/wiki/Help:Formula on MetaWiki] &mdash; Contains a long list of ''mathematics'' related LaTeX tags.
+
  
 +
\example
 +
 +
\end{document}
 +
</pre>
 +
==== Inserting Graphics ====
 +
The easiest way inserting graphics into your document is using the graphicx graphic bundle. Afterwards PostScript (ps) and Encapsulated PostScript Images (eps) can be inserted by saying <code>\includegraphics</code>.
 +
<pre>
 +
\begin[a4paper]{article}
 +
\usepackage{graphicx}
 +
 +
\begin{document}
 +
 +
\begin{figure}[h]
 +
\centering
 +
\includegraphics[width=5cm]{box.ps}
 +
\caption{This is an example for including a graphic using
 +
\texttt{graphicx.sty} and the \texttt{figure} environment}
 +
\label{fig:box}
 +
\end{figure}
 +
 +
\end{document}
 +
</pre>
 +
==== Extended ====
 +
<pre>
 +
\documentclass[amsmath,amssymb]{revtex4}
 +
\usepackage{graphicx}% Include figure files
 +
\usepackage{dcolumn}% Align table columns on decimal point
 +
\usepackage{bm}% bold math
 +
\usepackage{epsfig}% include .eps files for figures
 +
\usepackage[frenchb]{babel}% SmallCaps font
 +
 +
\begin{document}
 +
...
 +
\end{document}
 +
</pre>
 +
=== Tables ===
 +
<pre>
 +
\begin{table}
 +
\caption{\label{tab:table1}Table Title}
 +
\begin{ruledtabular}
 +
\begin{tabular}{rrrrrrrrrr}
 +
\multicolumn{5}{c}{Heading 1}&\multicolumn{5}{c}{Heading 2}\\
 +
Seg & Res & Atom & $<B>$ & $<$A$>$ & RMSD & {$T^rB$} & eval & $<B>$ & $<$A$>$\\
 +
\hline
 +
1-9 & 9 & 63 & 22.2 & 1.00 & 10.34 & 8.6 & 146.39 & 22.2 & 0.30\\
 +
10-15 & 6 & 41 & 14.7 & 1.00 & 6.99 & 1.3 & 0.00 & 14.7 & 0.17\\
 +
16-29 & 14 & 119 & 12.7 & 1.00 & 6.12 & 2.0 & 73.85 & 12.7 & 0.32\\
 +
30-47 & 18 & 130 & 7.4 & 1.00 & 2.79 & 2.9 & 11.28 & 7.4 & 0.69\\
 +
48-56 & 9 & 66 & 14.4 & 1.00 & 4.77 & -0.5 & 58.11 & 14.4 & 0.32\\
 +
\end{tabular}
 +
\end{ruledtabular}
 +
\end{table}
 +
</pre>
 +
=== Figures ===
 +
Adding figures is easy in LaTeX:
 +
ps2epsi input.ps output.eps
 +
<pre>
 +
\usepackage{epsfig} % place at top of .tex file
 +
...
 +
\begin{figure}[hbt]
 +
\begin{center}
 +
\psfig{file=output.eps,width=3.25in}
 +
\end{center}
 +
\caption[short TOC caption]{\em Testing 1FIN.}
 +
\label{ReferenceLabelHere}
 +
\end{figure}
 +
</pre>
 +
 +
===Watermarks===
 +
<pre>
 +
\documentclass{article}
 +
\usepackage{graphicx}
 +
\usepackage{type1cm}
 +
\usepackage{eso-pic}
 +
\usepackage{color}
 +
\makeatletter
 +
\AddToShipoutPicture{%
 +
            \setlength{\@tempdimb}{.5\paperwidth}%
 +
            \setlength{\@tempdimc}{.5\paperheight}%
 +
            \setlength{\unitlength}{1pt}%
 +
            \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
 +
        \makebox(0,0){\rotatebox{45}{\textcolor[gray]{0.75}%
 +
        {\fontsize{6cm}{6cm}\selectfont{DRAFT}}}}%
 +
            }%
 +
}
 +
\makeatother
 +
\title{Lorem ipsum}
 +
\begin{document}
 +
\maketitle
 +
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis dapibus.
 +
In hac habitasse platea dictumst. Aenean eu velit. Nullam eros. Vestibulum
 +
scelerisque tristique nisl. Maecenas in tortor sit amet justo rhoncus
 +
blandit. Cras eget ipsum bibendum massa ultricies sodales. Ut est arcu,
 +
elementum et, sagittis eget, pellentesque at, sem. Nam tincidunt. Curabitur
 +
urna arcu, ultrices nec, blandit ullamcorper, hendrerit id, ante. In
 +
tincidunt nonummy orci. Quisque eget sem. Ut aliquam augue eu libero. Sed
 +
turpis dui, euismod vel, ultricies sed, porta eget, lacus.
 +
\end{document}
 +
</pre>
 +
 +
=== tex2ps ===
 +
Convert your TeX file to a [[PostScript]] file ready for printing:
 +
latex input.tex && dvips -f input.dvi > output.ps
 +
Or, as a shell script:
 +
latex $1.tex && dvips -f $1.dvi > $1.ps
 +
 +
==HTML to LaTeX==
 +
see: http://html2latex.sourceforge.net/
 +
 +
%html -d tag-name options "LaTeX-open" "LaTeX-close"
 +
<pre>
 +
%html -d html    ""  ""
 +
%html -d head    ""  ""
 +
%html -d title  ""  ""
 +
%html -d body    -on ""  ""
 +
%html -d address ""  ""
 +
%html -d h1      -l1 "{\\LARGE \\bf " "}"
 +
%html -d h2      -l2 "{\\Large \\bf " "}"
 +
%html -d h3      -l3 "{\\large \\bf " "}"
 +
%html -d h4      -l4 "{\bf " "}"
 +
%html -d h5      -l5 "{\\small \\bf " "}"
 +
%html -d h6      -l6 "{\\footnotesize \\bf " "}"
 +
%html -d p      "\nl\nl"  ""
 +
%html -d ul      -igh "\nl\begin{itemize}"  "\nl\end{itemize}\nl"
 +
%html -d menu    -igh "\nl\begin{itemize}"  "\nl\end{itemize}\nl"
 +
%html -d dir    -gnh "\nl\begin{itemize}"  "\nl\end{itemize}\nl"
 +
%html -d ol      -igh "\nl\begin{enumerate}"  "\nl\end{enumerate}\nl"
 +
%html -d li      "\nl\item "  ""
 +
%html -d lh      "\nl\item "  ""
 +
%html -d dl      -igh "\nl\begin{description}"  "\nl\end{description}\nl"
 +
%html -d dt      "\nl\item["  "]"
 +
%html -d dd      ""  ""
 +
%html -d a      ""  ""
 +
%html -d q      "``"  "''"
 +
%html -d i      -iim "{\em "  "}"
 +
%html -d em      "{\em "  "}"
 +
%html -d b      "{\bf "  "}"
 +
%html -d strong  "{\bf "  "}"
 +
%html -d tt      "{\tt "  "}"
 +
%html -d samp    "{\tt "  "}"
 +
%html -d kbd    "{\tt "  "}"
 +
%html -d var    "{\sl "  "}"
 +
%html -d dfn    "{\sc "  "}"
 +
%html -d code    "{\tt "  "}"
 +
%html -d blink  ""  ""
 +
%html -d cite    "{\em "  "}"
 +
%html -d blockquote  -igh "\begin{quotation} "  "\end{quotation}\nl"
 +
%html -d bq      -igh "\begin{quotation} "  "\end{quotation}\nl"
 +
%html -d u      "\underbar{"  "}"
 +
 +
%html -d pre    -verb "\begin{verbatim} "  "\end{verbatim}\nl"
 +
%html -d xmp    -verb "\begin{verbatim} "  "\end{verbatim}\nl"
 +
%html -d listing -verb "\begin{verbatim} "  "\end{verbatim}\nl"
 +
%html -d br      -br "\newline\nl"  ""
 +
%html -d hr      "\vspace{1mm}\hrule "  ""
 +
%html -d img    ""  ""
 +
%html -d isindex ""  ""
 +
%html -d select  ""  ""
 +
%html -d link    ""  ""
 +
%html -d center  "{\centering "  "}"
 +
%html -d meta    ""  ""
 +
%html -d table  ""  ""
 +
%html -d tr      ""  ""
 +
%html -d td      ""  ""
 +
%html -d sup    "$^{" "}$"
 +
%html -d sub    "$_{" "}$"
 +
</pre>
 +
*Suggested alternative settings for the various tags are:
 +
<pre>
 +
%html -d title -on "\newpage\thispagestyle{myheadings}\markright{\sc{}" "}\pagenumbering{arabic}\nl\nl"
 +
%html -d h1 -l1 "{\nl\nl\smallskip\LARGE\bf\noindent " "}\nl\nl\noindent{}"
 +
%html -d h2 -l2 "{\nl\nl\smallskip\Large\bf\noindent " "}\nl\nl\noindent{}"
 +
%html -d h3 -l3 "{\nl\nl\smallskip\large\bf\noindent " "}\nl\nl\noindent{}"
 +
%html -d h4 -l4 "{\nl\nl\smallskip\bf\noindent " "}\nl\nl\noindent{}"
 +
%html -d h5 -l5 "{\nl\nl\smallskip\small\bf\noindent " "}\nl\nl\noindent{}"
 +
%html -d h6 -l6 "{\nl\nl\smallskip\footnotesize\bf\noindent " "}\nl\nl\noindent{}"
 +
%html -d code -math
 +
%html -d blockquote "\nl{\parindent=2em\narrower\nl" "\nl}\nl"
 +
</pre>
 +
*The default setting for the pseudo tags for the book and report styles are:
 +
<pre>
 +
%html -d l1      "\nl\nl\chapter{"  "}\nl\nl"
 +
%html -d l2      "\nl\nl\section{"  "}\nl\nl"
 +
%html -d l3      "\nl\nl\subsection{"  "}\nl\nl"
 +
%html -d l4      "\nl\nl\subsubsection{"  "}\nl\nl"
 +
%html -d l5      "\nl\nl\paragraph{"  "}\nl"
 +
%html -d l6      "\nl\nl\subparagraph{"  "}\nl"
 +
%html -d l7      ""  ""
 +
%html -d l8      ""  ""
 +
%html -d l9      ""  ""
 +
</pre>
 +
*The default setting for the pseudo tags for the article styles is:
 +
<pre>
 +
%html -d l1      "\nl\nl\section{"  "}\nl\nl"
 +
%html -d l2      "\nl\nl\subsection{"  "}\nl\nl"
 +
%html -d l3      "\nl\nl\subsubsection{"  "}\nl\nl"
 +
%html -d l4      "\nl\nl\paragraph{"  "}\nl"
 +
%html -d l5      "\nl\nl\subparagraph{"  "}\nl"
 +
%html -d l6      ""  ""
 +
%html -d l7      ""  ""
 +
%html -d l8      ""  ""
 +
%html -d l9      ""  ""
 +
</pre>
 +
*The default setting for the pseudo tags for the plain style is:
 +
<pre>
 +
%html -d l1      "\nl\nl\section*{"  "}\nl\nl"
 +
%html -d l2      "\nl\nl\subsection*{"  "}\nl\nl"
 +
%html -d l3      "\nl\nl\subsubsection*{"  "}\nl\nl"
 +
%html -d l4      "\nl\nl\paragraph*{"  "}\nl"
 +
%html -d l5      "\nl\nl\subparagraph*{"  "}\nl"
 +
%html -d l6      ""  ""
 +
%html -d l7      ""  ""
 +
%html -d l8      ""  ""
 +
%html -d l9      ""  ""
 +
</pre>
 
==External links==
 
==External links==
  
 
===Community===
 
===Community===
* [http://www.latex-project.org/ Official LaTeX project site] web site for open development of LaTeX (you can also obtain a CVS snapshot of LaTeX3, the next version of LaTeX which is not yet released)
+
*[http://www.latex-project.org/ Official LaTeX project site] web site for open development of LaTeX (you can also obtain a CVS snapshot of LaTeX3, the next version of LaTeX which is not yet released)
* [http://www.tug.org/ The TeX Users Group]
+
*[http://tug.ctan.org/ CTAN.org] &mdash; the Comprehensive TeX Archive Network
* [news:comp.text.tex comp.text.tex]. A [[Usenet]] newsgroup for (La)TeX related questions, comp.text.tex is an invaluable resource for (La)TeX. Search the archives with [http://groups.google.com/group/comp.text.tex Google Groups] before posting.
+
*[http://www.tug.org/ The TeX Users Group]
* [irc://irc.freenode.net/#latex #latex] [[Internet relay chat|IRC]] chat room on [[Freenode]]
+
*[news:comp.text.tex comp.text.tex]. A Usenet newsgroup for (La)TeX related questions, comp.text.tex is an invaluable resource for (La)TeX. Search the archives with [http://groups.google.com/group/comp.text.tex Google Groups] before posting.
 +
*[irc://irc.freenode.net/#latex #latex] IRC chat room on Freenode
  
 
===Periodicals===
 
===Periodicals===
Line 88: Line 298:
  
 
===Tutorials/FAQs===
 
===Tutorials/FAQs===
* [http://www.lecb.ncifcrf.gov/~toms/latexforbeginners.html LaTeX for Beginners]
+
*[[wikipedia:LaTeX]]
* [http://people.ee.ethz.ch/~oetiker/lshort/lshort.pdf The Not So Short Introduction to LaTeX2e], or LaTeX2e in 133 minutes (2.21 [[Mebibyte|MiB]] [[Portable_Document_Format|PDF]] file).
+
*[[wikibooks:LaTeX]]
* [http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes The UK TeX FAQ] List of questions and answers that are frequently posted at comp.text.tex.
+
*[http://commons.wikimedia.org/wiki/Category:LaTeX Wikimedia Commons - Category:LaTeX]
* [http://www.ctan.org/tex-archive/info/beginlatex/ Formatting Information] Online book for beginners available in [http://www.ctan.org/tex-archive/info/beginlatex/html/index.html HTML] and [http://www.ctan.org/tex-archive/info/beginlatex/beginlatex-3.6.pdf PDF]
+
*[http://www.lecb.ncifcrf.gov/~toms/latexforbeginners.html LaTeX for Beginners]
* [http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/ LaTeX Primer] A basic guide to LaTeX.
+
*[[Image:icon_pdf.gif|PDF]][http://people.ee.ethz.ch/~oetiker/lshort/lshort.pdf The Not So Short Introduction to LaTeX2e], or LaTeX2e in 133 minutes (2.21 MiB).
* [http://www.tug.org.in/tutorials.html Tutorials in LaTeX] Free manual distributed by the India TeX Users Group (TUG).
+
*[http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes The UK TeX FAQ] List of questions and answers that are frequently posted at comp.text.tex.
* [ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf The AMS Short Math Guide for LaTeX] A concise summary of math formula typesetting features (PDF file).
+
*[http://www.ctan.org/tex-archive/info/beginlatex/ Formatting Information] Online book for beginners available in [http://www.ctan.org/tex-archive/info/beginlatex/html/index.html HTML] and [http://www.ctan.org/tex-archive/info/beginlatex/beginlatex-3.6.pdf PDF]
* [http://www.rna.nl/tex.html TeX on Mac OS X] Guide to using TeX and LaTeX on a Mac.
+
*[http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/ LaTeX Primer] A basic guide to LaTeX.
* [http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ Text Processing using LaTeX]
+
*[http://www.tug.org.in/tutorials.html Tutorials in LaTeX] Free manual distributed by the India TeX Users Group (TUG).
* [http://tex.loria.fr/index.html The (La)TeX encyclopaedia]
+
*[[Image:icon_pdf.gif|PDF]][ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf The AMS Short Math Guide for LaTeX] A concise summary of math formula typesetting features.
* [http://www.giss.nasa.gov/latex/ Hypertext Help with LaTeX]
+
*[http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ Text Processing using LaTeX]
* [http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ltxprimer-1.0.pdf LaTeX Tutorials: a Primer] (PDF file)
+
*[http://tex.loria.fr/index.html The (La)TeX encyclopaedia]
* [http://www.andy-roberts.net/misc/latex/index.html Getting to Grips with LaTeX] Latex tutorials taking you from the very basics towards more advanced topics.
+
*[http://www.giss.nasa.gov/latex/ Hypertext Help with LaTeX]
* [http://www.math.auc.dk/~dethlef/Tips/preparation.html LaTeX, Emacs etc. for your PC] A useful and step-by-step guide to getting Miktex and Emacs working together on a Windows PC.
+
*[[Image:icon_pdf.gif|PDF]][http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ltxprimer-1.0.pdf LaTeX Tutorials: a Primer]
 +
*[http://www.andy-roberts.net/misc/latex/index.html Getting to Grips with LaTeX] Latex tutorials taking you from the very basics towards more advanced topics.
 +
*[http://journal.redflavor.com/working-effectively-with-large-latex-documents Working Effectively with Large LaTeX Documents]
  
 
===Add-on Packages===
 
===Add-on Packages===
* [http://latex-beamer.sourceforge.net/ LaTeX-beamer] Create sophisticated, structured presentations and slides using LaTeX.
+
*[http://latex-beamer.sourceforge.net/ LaTeX-beamer] Create sophisticated, structured presentations and slides using LaTeX.
* [http://www.ctan.org/tex-archive/macros/latex/contrib/powerdot/ powerdot] Another very good class for presentations.
+
*[http://www.ctan.org/tex-archive/macros/latex/contrib/powerdot/ powerdot] Another very good class for presentations.
* [http://www.phil.cam.ac.uk/teaching_staff/Smith/LaTeX/nd.html bussproofs.sty (and others)] Setting natural deduction tree proofs.
+
*[http://www.phil.cam.ac.uk/teaching_staff/Smith/LaTeX/nd.html bussproofs.sty (and others)] Setting natural deduction tree proofs.
* [http://www.mcnabbs.org/andrew/linux/latexres/ Making a Resume in LaTeX] A LaTeX template with instructions for making an easily-maintained resume.
+
*[http://www.mcnabbs.org/andrew/linux/latexres/ Making a Resume in LaTeX] A LaTeX template with instructions for making an easily-maintained resume.
* [http://latex2rtf.sourceforge.net/ LaTeX2RTF] Translator program which is intended to convert a LaTeX document into the RTF format.
+
*[http://latex2rtf.sourceforge.net/ LaTeX2RTF] Translator program which is intended to convert a LaTeX document into the RTF format.
  
===Reference===
+
===Utilities===
* [http://www.ctan.org The Comprehensive TeX Archive Network] Latest (La)TeX-related packages and software
+
*[http://dblatex.sourceforge.net/ dblatex] &mdash; DocBook to LaTeX/ConTeXt Publishing
* [http://www.tug.org/tds/ TeX Directory Structure], used by many (La)TeX distributions
+
**[http://docbook.org/tdg/en/html/docbook.html DocBook: The Definitive Guide]
* [http://www.math.missouri.edu/~stephen/naturalmath/ Natural Math] converts natural language math formulas to LaTeX representation
+
* [http://www.ctan.org/tex-archive/info/l2tabu/english/l2tabuen.pdf Obsolete packages and commands]
+
* [http://www.miktex.org/ MiKTeX] A popular and up-to-date TeX (including LaTeX) implementation for Windows.
+
*{{Book reference |Author=Mittelbach, Frank, and Goossens, Michel | Title=The LaTeX Companion, Second Edition | Publisher=Addison-Wesley | Year=2004 | ID=ISBN 0201362996| URL=http://www.latex-project.org/guides/books.html}}. The ''Companion'' is an excellent resource for intermediate to advanced LaTeX users. For those already somewhat familiar with LaTeX, this is probably the single most useful available book on the subject. The book website has the complete Table of Contents and a sample chapter available for download.
+
  
== Source ==
+
===Reference===
* [http://en.wikipedia.org/wiki/LaTeX Wikipedia article on '''LaTeX''']
+
*[http://www.ctan.org The Comprehensive TeX Archive Network] Latest (La)TeX-related packages and software
 +
*[http://www.tug.org/tds/ TeX Directory Structure], used by many (La)TeX distributions
 +
*[http://www.math.missouri.edu/~stephen/naturalmath/ Natural Math] converts natural language math formulas to LaTeX representation
 +
*[http://www.tex.ac.uk/tex-archive/help/Catalogue/catalogue.html The TeX Catalogue Online], Ctan Edition, listing 2,956 TeX, LaTeX, and related packages and tools.
 +
*[[Image:icon_pdf.gif|PDF]][http://www.ctan.org/tex-archive/info/l2tabu/english/l2tabuen.pdf Obsolete packages and commands]
 +
===Other===
 +
*[http://nitens.org/taraborelli/latex The beauty of LaTeX]
  
 
[[Category:Technical and Specialized Skills]]
 
[[Category:Technical and Specialized Skills]]
 
[[Category:TeX]]
 
[[Category:TeX]]

Latest revision as of 01:17, 24 June 2008

LATEX, written as LaTeX in plain text, is a document preparation system for the TeX typesetting program.

Examples

A base document

Note: This is a useful starting point for a large document or book.

\documentclass[11pt,a4paper]{book}

\title{A Long Master Thesis}

\author{Eivind Uggedal}

\begin{document}

  \frontmatter
    \maketitle
    \tableofcontents
    \listoffigures
    \listoftables
    \include{acknowledgements}

  \mainmatter
    \include{introduction}
    \include{background}
    \include{methodology}
    \include{implementation}
    \include{analysis}
    \include{discussion}
    \include{conclusion}

  \appendix
    \include{questionnaire}
    \include{source.code}

  \backmatter
    \bibliography{bib.items}

\end{document}

Document (basics)

Article with text only

\documentclass{article}

\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis dapibus. 
In hac habitasse platea dictumst. Aenean eu velit. Nullam eros. Vestibulum 
scelerisque tristique nisl. Maecenas in tortor sit amet justo rhoncus 
blandit. Cras eget ipsum bibendum massa ultricies sodales. Ut est arcu, 
elementum et, sagittis eget, pellentesque at, sem. Nam tincidunt. Curabitur 
urna arcu, ultrices nec, blandit ullamcorper, hendrerit id, ante. In 
tincidunt nonummy orci. Quisque eget sem. Ut aliquam augue eu libero. Sed 
turpis dui, euismod vel, ultricies sed, porta eget, lacus.
\end{document}

Definition of macros for later use in document

\documentclass{article}
\usepackage{german}

% The example macro generates the marker for an example inside a document
\def\example{\refstepcounter{subsection}
	\paragraph{\underline{$\rhd$\ Example\ \thesubsection}}}

\begin{document}

To generate the header for an example inside your document you now
	simply need to type:

\example

\end{document}

Inserting Graphics

The easiest way inserting graphics into your document is using the graphicx graphic bundle. Afterwards PostScript (ps) and Encapsulated PostScript Images (eps) can be inserted by saying \includegraphics.

\begin[a4paper]{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}[h]
	\centering
	\includegraphics[width=5cm]{box.ps}
	\caption{This is an example for including a graphic using
	\texttt{graphicx.sty} and the \texttt{figure} environment}
	\label{fig:box}
\end{figure}

\end{document}

Extended

\documentclass[amsmath,amssymb]{revtex4}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{epsfig}% include .eps files for figures
\usepackage[frenchb]{babel}% SmallCaps font

\begin{document}
...
\end{document}

Tables

\begin{table}
\caption{\label{tab:table1}Table Title}
\begin{ruledtabular}
\begin{tabular}{rrrrrrrrrr}
\multicolumn{5}{c}{Heading 1}&\multicolumn{5}{c}{Heading 2}\\
Seg & Res & Atom & $<B>$ & $<$A$>$ & RMSD & {$T^rB$} & eval & $<B>$ & $<$A$>$\\
\hline
1-9 & 9 & 63 & 22.2 & 1.00 & 10.34 & 8.6 & 146.39 & 22.2 & 0.30\\
10-15 & 6 & 41 & 14.7 & 1.00 & 6.99 & 1.3 & 0.00 & 14.7 & 0.17\\
16-29 & 14 & 119 & 12.7 & 1.00 & 6.12 & 2.0 & 73.85 & 12.7 & 0.32\\
30-47 & 18 & 130 & 7.4 & 1.00 & 2.79 & 2.9 & 11.28 & 7.4 & 0.69\\
48-56 & 9 & 66 & 14.4 & 1.00 & 4.77 & -0.5 & 58.11 & 14.4 & 0.32\\
\end{tabular}
\end{ruledtabular}
\end{table}

Figures

Adding figures is easy in LaTeX:

ps2epsi input.ps output.eps
\usepackage{epsfig} % place at top of .tex file
...
\begin{figure}[hbt]
\begin{center}
\psfig{file=output.eps,width=3.25in}
\end{center}
\caption[short TOC caption]{\em Testing 1FIN.}
\label{ReferenceLabelHere}
\end{figure}

Watermarks

\documentclass{article}
\usepackage{graphicx}
\usepackage{type1cm}
\usepackage{eso-pic}
\usepackage{color}
\makeatletter
\AddToShipoutPicture{%
            \setlength{\@tempdimb}{.5\paperwidth}%
            \setlength{\@tempdimc}{.5\paperheight}%
            \setlength{\unitlength}{1pt}%
            \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
        \makebox(0,0){\rotatebox{45}{\textcolor[gray]{0.75}%
        {\fontsize{6cm}{6cm}\selectfont{DRAFT}}}}%
            }%
}
\makeatother
\title{Lorem ipsum}
\begin{document}
\maketitle
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis dapibus. 
In hac habitasse platea dictumst. Aenean eu velit. Nullam eros. Vestibulum 
scelerisque tristique nisl. Maecenas in tortor sit amet justo rhoncus 
blandit. Cras eget ipsum bibendum massa ultricies sodales. Ut est arcu, 
elementum et, sagittis eget, pellentesque at, sem. Nam tincidunt. Curabitur 
urna arcu, ultrices nec, blandit ullamcorper, hendrerit id, ante. In 
tincidunt nonummy orci. Quisque eget sem. Ut aliquam augue eu libero. Sed 
turpis dui, euismod vel, ultricies sed, porta eget, lacus.
\end{document}

tex2ps

Convert your TeX file to a PostScript file ready for printing:

latex input.tex && dvips -f input.dvi > output.ps

Or, as a shell script:

latex $1.tex && dvips -f $1.dvi > $1.ps

HTML to LaTeX

see: http://html2latex.sourceforge.net/
%html -d tag-name options "LaTeX-open" "LaTeX-close"
%html -d html    ""  ""
%html -d head    ""  ""
%html -d title   ""  ""
%html -d body    -on ""  ""
%html -d address ""  ""
%html -d h1      -l1 "{\\LARGE \\bf " "}"
%html -d h2      -l2 "{\\Large \\bf " "}"
%html -d h3      -l3 "{\\large \\bf " "}"
%html -d h4      -l4 "{\bf " "}"
%html -d h5      -l5 "{\\small \\bf " "}"
%html -d h6      -l6 "{\\footnotesize \\bf " "}"
%html -d p       "\nl\nl"  ""
%html -d ul      -igh "\nl\begin{itemize}"  "\nl\end{itemize}\nl"
%html -d menu    -igh "\nl\begin{itemize}"  "\nl\end{itemize}\nl"
%html -d dir     -gnh "\nl\begin{itemize}"  "\nl\end{itemize}\nl"
%html -d ol      -igh "\nl\begin{enumerate}"  "\nl\end{enumerate}\nl"
%html -d li      "\nl\item "  ""
%html -d lh      "\nl\item "  ""
%html -d dl      -igh "\nl\begin{description}"  "\nl\end{description}\nl"
%html -d dt      "\nl\item["  "]"
%html -d dd      ""  ""
%html -d a       ""  ""
%html -d q       "``"  "''"
%html -d i       -iim "{\em "  "}"
%html -d em      "{\em "  "}"
%html -d b       "{\bf "  "}"
%html -d strong  "{\bf "  "}"
%html -d tt      "{\tt "  "}"
%html -d samp    "{\tt "  "}"
%html -d kbd     "{\tt "  "}"
%html -d var     "{\sl "  "}"
%html -d dfn     "{\sc "  "}"
%html -d code    "{\tt "  "}"
%html -d blink   ""  ""
%html -d cite    "{\em "  "}"
%html -d blockquote  -igh "\begin{quotation} "  "\end{quotation}\nl"
%html -d bq      -igh "\begin{quotation} "  "\end{quotation}\nl"
%html -d u       "\underbar{"  "}"

%html -d pre     -verb "\begin{verbatim} "  "\end{verbatim}\nl"
%html -d xmp     -verb "\begin{verbatim} "  "\end{verbatim}\nl"
%html -d listing -verb "\begin{verbatim} "  "\end{verbatim}\nl"
%html -d br      -br "\newline\nl"  ""
%html -d hr      "\vspace{1mm}\hrule "  ""
%html -d img     ""  ""
%html -d isindex ""  ""
%html -d select  ""  ""
%html -d link    ""  ""
%html -d center  "{\centering "  "}"
%html -d meta    ""  ""
%html -d table   ""  ""
%html -d tr      ""  ""
%html -d td      ""  ""
%html -d sup     "$^{" "}$"
%html -d sub     "$_{" "}$"
  • Suggested alternative settings for the various tags are:
%html -d title -on "\newpage\thispagestyle{myheadings}\markright{\sc{}" "}\pagenumbering{arabic}\nl\nl"
%html -d h1 -l1 "{\nl\nl\smallskip\LARGE\bf\noindent " "}\nl\nl\noindent{}"
%html -d h2 -l2 "{\nl\nl\smallskip\Large\bf\noindent " "}\nl\nl\noindent{}"
%html -d h3 -l3 "{\nl\nl\smallskip\large\bf\noindent " "}\nl\nl\noindent{}"
%html -d h4 -l4 "{\nl\nl\smallskip\bf\noindent " "}\nl\nl\noindent{}"
%html -d h5 -l5 "{\nl\nl\smallskip\small\bf\noindent " "}\nl\nl\noindent{}"
%html -d h6 -l6 "{\nl\nl\smallskip\footnotesize\bf\noindent " "}\nl\nl\noindent{}"
%html -d code -math
%html -d blockquote "\nl{\parindent=2em\narrower\nl" "\nl}\nl"
  • The default setting for the pseudo tags for the book and report styles are:
%html -d l1      "\nl\nl\chapter{"  "}\nl\nl"
%html -d l2      "\nl\nl\section{"  "}\nl\nl"
%html -d l3      "\nl\nl\subsection{"  "}\nl\nl"
%html -d l4      "\nl\nl\subsubsection{"  "}\nl\nl"
%html -d l5      "\nl\nl\paragraph{"  "}\nl"
%html -d l6      "\nl\nl\subparagraph{"  "}\nl"
%html -d l7      ""  ""
%html -d l8      ""  ""
%html -d l9      ""  ""
  • The default setting for the pseudo tags for the article styles is:
%html -d l1      "\nl\nl\section{"  "}\nl\nl"
%html -d l2      "\nl\nl\subsection{"  "}\nl\nl"
%html -d l3      "\nl\nl\subsubsection{"  "}\nl\nl"
%html -d l4      "\nl\nl\paragraph{"  "}\nl"
%html -d l5      "\nl\nl\subparagraph{"  "}\nl"
%html -d l6      ""  ""
%html -d l7      ""  ""
%html -d l8      ""  ""
%html -d l9      ""  ""
  • The default setting for the pseudo tags for the plain style is:
%html -d l1      "\nl\nl\section*{"  "}\nl\nl"
%html -d l2      "\nl\nl\subsection*{"  "}\nl\nl"
%html -d l3      "\nl\nl\subsubsection*{"  "}\nl\nl"
%html -d l4      "\nl\nl\paragraph*{"  "}\nl"
%html -d l5      "\nl\nl\subparagraph*{"  "}\nl"
%html -d l6      ""  ""
%html -d l7      ""  ""
%html -d l8      ""  ""
%html -d l9      ""  ""

External links

Community

  • Official LaTeX project site web site for open development of LaTeX (you can also obtain a CVS snapshot of LaTeX3, the next version of LaTeX which is not yet released)
  • CTAN.org — the Comprehensive TeX Archive Network
  • The TeX Users Group
  • comp.text.tex. A Usenet newsgroup for (La)TeX related questions, comp.text.tex is an invaluable resource for (La)TeX. Search the archives with Google Groups before posting.
  • #latex IRC chat room on Freenode

Periodicals

Tutorials/FAQs

Add-on Packages

Utilities

Reference

Other