Contents:
1. Installation of the LaTeX system
2. MiKTeX options
3. Short LaTeX guide and other literature
4. Structure of LaTeX document
5. Preamble
6. Body
7. LaTeX versus pdfLaTeX
8. Including EPS graphics in LaTeX documents
9. Including PDF graphics in pdfLaTeX documents
10. How do I make good Postscript (PS) documents?
11. How do I make good PDF documents?
12. Printing of LaTeX documents
13. Model template for exercises
14. Happy LaTeXing!
Corrections
lshort.pdf' and 'lshort.ps'), and in Finnish (slightly older but useful version, directory ftp://ftp.funet.fi/pub/TeX/tex-archive/info/lshort/finnish/).
These short guides concentrate on the most essential and frequently needed features which may be difficult to locate from the more thorough presentations.
Of the more comprehensive LaTeX guides the following could be mentioned:
\documentclass[options]{classname}
..
..
\begin{document}
..
..
\end{document}
(Sometimes there may be plain TeX instructions even before the '\documentclass' command). The first slot is a header called the preamble, containing possible additional definitions and extensions to the basic classname style. The most frequently used classnames are book, article, report, and slides, and typical options are 11pt, 12pt, a4paper, and twoside. The second slot contains the body of the document.
\usepackage[latin1]{inputenc}
latin1' means the ISO 8859-1 (Latin-1) standard for the character encoding of the input text. This contains most of the European accented characters such as ä, ö, é, è etc. This option is good for texts written in the Windows and unix environments, although for Windows an even better option would be 'ansinew'.
\usepackage[finnish]{babel}
\usepackage[german,swedish,finnish]{babel}' can be used. In this case the last language becomes the default for the document.
\usepackage[T1]{fontenc}
\showhyphens{wordtobehyphenated, anothersuchword, ...}' in the body of the document. After typesetting, read the file 'myfile.log' (if the original main tex file is 'myfile.tex') to see the suggested hyphenation.
\usepackage{ae,aecompl}
A useful alternative to the T1 fontenc, see section 10!
\usepackage{amsbsy,amssymb}
amsbsy' is a very useful package allowing bold mathematical symbols to be used with the command '\boldsymbol{...}' in the math environment. Example: 'ak' is written as 'a_{\boldsymbol{k}}'. 'amssymb' is a package providing a huge set of symbols due to the American Mathematical Society (AMS; see the references).
\usepackage{graphicx}
\usepackage{feynmf}
\rm', '\em', '\bf', '\tt' etc. Although they still may work in LaTeX2e, it is better to use the new LaTeX2e font commands. The above cases become, respectively, '\textrm{text}', '\emph{text}', '\textbf{text}', '\texttt{text}'. In WinEdt the enclosed text is nicely shown in the style implied by the command.
Also, forget everything you have learnt from LaTeX2.09 about placing graphics in the documents. Memorize the new very simple conventions which are (to some extent) explained below!
latex myfile[.tex] pdflatex myfile[.tex]LaTeX typesetting produces an intermediate DVI file, which can be viewed with a dvi preview program, e.g., in Windows with Yap ('yet another previewer'; comes with MiKTeX), or in unix with xdvi. pdfLaTeX typesetting produces directly the PDF file, which can be viewed by Acrobat Reader. To take real advantage of the pdfLaTeX format one can utilize the '
hyperref' package to include hypertext links of various kinds (this will not be elaborated here). There are also differences in including pictures in the two formats, see below.
\usepackage{graphicx}
in the preamble, and to place the picture in the document use, e.g., the following command:
\includegraphics{myfig.eps}
This command places the picture in its default size in the current position just as a large letter. To change the size and orientation of the picture one can use the commands:
\resizebox{x-length}{y-length}{...}
\scalebox{x-scale}[y-scale]{...}
\rotatebox{angle}{...}
If one of the lengths in '\resizebox' is given as !, the picture is proportionally scaled according to the other length. In '\scalebox' the y-scale is optional and can be left out in which case the x-scale applies to both directions. In the dotted boxes there can be anything, e.g., arbitrary text or nested commands such as
\rotatebox{-37}{\resizebox{27mm}{!}{\includegraphics{myfig.eps}}}
With the graphicx package, the picture-manipulating commands may also be combined, e.g., as in
\includegraphics[width=27mm, angle=-37]{myfig.eps}
The options are processed from left to right.
epstopdf myfig.epsin both the Windows and the Linux/unix platforms (in the appropriate folder). (With WinEdt, the console window in the appropriate directory is easily opened from a toolbar button.) This command knows how to cut the picture along the bounding box of the eps figure. When all the pictures are in pdf form, the figures are included in the pdfLaTeX document precisely in the same way as in the previous section, except that the figure name is of the form myfig.pdf. Thus, in particular, the preamble should contain the command '
\usepackage{graphicx}'.
(On the other hand, if the postscript document already exists, it can be converted into a pdf document without using pdfLaTeX, see 10-11.)
dvips -Ppdf ... myfile.dviHere the dots signify other possible options (for dvips there are quite a lot of them!). (Technically, the dvips program then reads the additional configuration file 'config.pdf', if such exists. This file contains instructions to use postscript fonts). The cm fonts do not allow perfect hyphenation of words with accented characters. As mentioned in section 5, the EC fonts are better in this respect, but unfortunately there are no freeware postscript definitions available for them so far (however, see corrections in the end!). Therefore, if the command '
\usepackage[T1]{fontenc}' is used in the preamble, the resulting PS document uses bitmap fonts (this would be the case also with the cm fonts, if dvips were invoked without the '-Ppdf' option). While waiting for the postscript EC fonts to be given from heaven, there is an intermediate solution in the form of the 'ae' package due to Lars Engebretsen (ae standing for 'almost European'). This package advices LaTeX to use 'ae' fonts which are actually combined from the standard cm characters and their accent signs. (This technique is apparently similar to what was used in the old multilingual MLTeX, which contained TeX primitives for character composition). This package (together with the complementary 'aecompl') has been included in the standard LaTeX distribution since ca. 1999.
Thus, one should replace the T1 fontenc package command by
\usepackage{ae,aecompl}
to produce good PS output.
dvipdfm myfile.dvi
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=myfile.pdf myfile.ps &unless a direct 'ps2pdf' or 'pstopdf' command has been defined.
% Tiedosto xtemplate.tex, malli vaikkapa harjoitustehtäväpapereille
% Huomaa että prosenttimerkin jälkeinen rivin osa on kommenttia
%
\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[finnish]{babel}
\usepackage{ae,aecompl,amsbsy,amssymb,eurosym}
\usepackage{graphicx}
\begin{document}
\noindent
\textsc{Helsingin yliopisto} \hspace{\stretch{1}}
\textsc{Fysikaalisten tieteiden laitos}
\begin{center}
{\large \textbf{Approksimatiivisen fysiikan harjoitus no. 2, kevät 2002}} \\
\textbf{Palautetaan viimeistään Ke 9.1.2002 klo 15}
\end{center}
\begin{enumerate}
\item
Ensimmäinen harjoitus: vääntele tiikeriä
\scalebox{0.4}{\includegraphics{tigger.eps}}
\hspace{\stretch{1}}
\raisebox{1.5cm}{%
\scalebox{0.5}[0.25]{\rotatebox{-37}{\includegraphics{tigger.eps}}}
}
\item
Toinen harjoitus: \EUR{25} = 25 \euro\ = 25 euroa.
{\footnotesize Footnote-koossa: 25 \euro.}
\item
Kolmas harjoitus: tutki suomalaisen tavutuksen erikoisuuksia ja
lue myös tiedosto \texttt{xtemplate.log}:
laktoosi-intoleranssi, laktoosi"-intoleranssi, kaivosaukko,
kaivos\-aukko, hääyöaie.
Huomaa että suomalaisessa babel-dokumentissa lainausmerkillä on
erikoismerkitys. Tekstissä lainausmerkki pitää merkitä kahdella
peräkkäisellä heittomerkillä:\ ''lainaus'' (tai ``lainaus'').
\showhyphens{laktoosi-intoleranssi, laktoosi"-intoleranssi,
kaivosaukko, kaivos\-aukko, hääyöaie}
\item
Vielä yksi... Muunna esimerkiksi kuva tigger.eps pdf-tiedostoksi
ja prosessoi tämä harjoitus pdf\,\LaTeX :lla.
\end{enumerate}
\end{document}
Beginning
Theory home