|
|
|||
![]() |
Department of Engineering |
| University of Cambridge > Engineering Department > computing help > LaTeX |
LaTeX is a way of writing documents that is more like writing a program than using Word. You write the "source code" using a text editor (Notepad or Word will do) then you "compile" it. You can get "front-ends" of various complexity to help you, but I'll concentrate on the basics here without depending on particular operating systems or extra programs.
So why use LaTeX What are the pros and cons?
Here's a latex file
\documentclass{article}
\usepackage{times}
\begin{document}
\section{Introduction}
Hello!
\end{document}
If I save it as foo.tex and process it I get the following, which isn't as scary as it looks.
This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) entering extended mode (./foo.tex LaTeX2e <2003/12/01> Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, b ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur kish, ukrainian, nohyphenation, loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2004/02/16 v1.4f Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/usr/share/texmf/tex/latex/psnfss/times.sty) No file foo.aux. (/usr/share/texmf/tex/latex/psnfss/ot1ptm.fd) [1] (./foo.aux) ) Output written on foo.dvi (1 page, 300 bytes). Transcript written on foo.log. |
.tex -> (latex) -> DVI -> (dvips) -> PS -> (ps2pdf) -> PDF
-> (dvipdfm) -> PDF
-> (latex2html) -> HTML
-> (pdflatex) -> PDF
|
Nowadays I usually use pdflatex rather than latex to process files to produce PDF directly.
As you write bigger files you'll need more commands. If you're writing an essay you might not need to know many more: \textit{...} does italics, \includegraphics{filename.jpg} includes graphics (you need \usepackage{graphicx} to make it work), \tableofcontents adds a table of contents. I suggest you look up features as you go along using the resources mentioned below.
\documentclass{article}
% It's fairly common to use a sans-serif font for headings
% The following line, if uncommented, does this using a package
% \usepackage{sfheaders}
% If you don't have the package on your machine, download it
% from http://www.ctan.org/tex-archive/macros/latex/contrib/sfheaders/
% If you want table numbers to be reset in each section, use the next 2 lines
\usepackage{chngcntr}
\counterwithin{table}{section}
\usepackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]{caption}
% The first time you process this document you'll need to process it
% twice to make of the references work.
\usepackage{times}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\section{One}
This document has no tables or figures, but it has the captions for them.
Later you might be interested in table \ref{TABLEB} or in a footnote\footnote{some small print}
\begin{table}[htbp]
\caption{\label{TABLEA}A table}
\end{table}
\section{Two}
Now for some maths
\begin{equation}
x=y\sum_{i=0}^\infty\sin(i)\label{SIN}
\end{equation}
\subsection{Detail}
We'd better go into detail now
\begin{figure}[htbp]
\caption{\label{FIGA}A figure}
\end{figure}
\subsubsection{More detail}
\begin{table}[htbp]
\caption{\label{TABLEB}Another table}
\end{table}
Earlier in equation \ref{SIN} we set x to a value.
\end{document}
Running pdflatex on this twice will produce this PDF file. Then you can do latex2html filename to produce a tree of WWW pages.
Maybe try
| | computing help | LaTeX | |