LaTeX Template
From McGill University Physics Department Technical Services Wiki
| Table of contents |
Files
The files used in the template are available below, right click on the links to save them to disk (left clicking might work too, but depending on how your browser is configured it might try to view the files instead.
- template.tex (http://www.ugrad.physics.mcgill.ca/resources/latex/template/template.tex) - the source code of the document
- report.bib (http://www.ugrad.physics.mcgill.ca/resources/latex/template/report.bib) - bibliographic entries used in document
- pendulum.eps (http://www.ugrad.physics.mcgill.ca/resources/latex/template/pendulum.eps) and gaussian.eps (http://www.ugrad.physics.mcgill.ca/resources/latex/template/gaussian.eps) - a couple of EPS figures refered to in the document
- template.tar.bz2 (http://www.ugrad.physics.mcgill.ca/resources/latex/template/template.tar.bz2) - A compressed tarfile containing all of files above for those who are quickly bored by multiple downloads.
- template.pdf (http://www.ugrad.physics.mcgill.ca/resources/latex/template/template.pdf) - this is a rendered PDF of what the template looks like when compiled.
Other Resources
- The Not So Short Introduction to LATEX 2ε (http://www.ugrad.physics.mcgill.ca/resources/latex/lshort.pdf)
Getting the files
If you are a clicker, grab the files an place them in a subdirectory somewhere. If you are lazy like me you might try the following:
mark.orchard-webb@artemis:~$ wget http://www/resources/latex/template/template.tar.bz2
--18:18:03-- http://www/resources/latex/template/template.tar.bz2
=> `template.tar.bz2'
Resolving www... 132.206.252.2
Connecting to www[132.206.252.2]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9,180 [application/x-tar]
100%[====================================>] 9,180 --.--K/s
18:18:03 (1.66 MB/s) - `template.tar.bz2' saved [9180/9180]
mark.orchard-webb@artemis:~$ tar jxvvf template.tar.bz2
tar: Record size = 8 blocks
-rw-r--r-- /users 7095 2006-01-11 18:04:24 LaTeX_Template/template.tex
drwxrwxrwx Creating directory: LaTeX_Template
-rw-r--r-- /users 17478 2004-01-14 16:02:20 LaTeX_Template/pendulum.eps
-rw-r--r-- /users 259563 2004-01-14 17:20:59 LaTeX_Template/gaussian.eps
-rw-r--r-- /users 1171 2006-01-11 17:45:56 LaTeX_Template/report.bib
mark.orchard-webb@artemis:~$ cd LaTeX_Template
However the result is achived you should have the following set of files
mark.orchard-webb@artemis:~/LaTeX_Template$ ls -l total 288 -rw-r--r-- 1 mark.orchard-webb ADSusers 259563 Jan 14 2004 gaussian.eps -rw-r--r-- 1 mark.orchard-webb ADSusers 17478 Jan 14 2004 pendulum.eps -rw-r--r-- 1 mark.orchard-webb ADSusers 1171 Jan 11 17:45 report.bib -rw-r--r-- 1 mark.orchard-webb ADSusers 7095 Jan 11 18:04 template.tex
\subsection{From The Command-line} At the prompt, type ``latex template.tex If the compilation is without major incident, the prompt will return after a fairly verbose tirade. To now view the resulting DVI file, type ``xdvi template.dvi \&.
\subsection{From Inside Emacs} Open the file in emacs, type ``ctrl-c ctrl-f, this compiles the file, then ``ctrl-c ctrl-v will pop up xdvi. A handy technique when editing \LaTeX\ files is to remember that xdvi automatically updates, so rather than closing xdvi, editing, recompiling, reopening xdvi and then paging to the appropriate location to check the effect --- leave xdvi open at the page of interest and use the window manager to switch between emacs and xdvi. (Try ``ctrl-alt-shift-pgdn a few times)
Compiling the template
There are several stages to this operation. The first is to parse the document for syntactic correctness, which will create the files required by the later stages.
mark.orchard-webb@artemis:~/LaTeX_Template$ latex template This is e-TeX, Version 3.14159-2.1 (Web2C 7.4.5) entering extended mode (./template.tex LaTeX2e <2001/06/01> Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, b ahasa, basque, catalan, croatian, czech, danish, dutch, finnish, greek, iceland ic, irish, italian, latin, magyar, norsk, norsk, portuges, romanian, russian, s lovak, slovene, spanish, swedish, turkish, ukrainian, nohyphenation, loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/usr/share/texmf/tex/latex/misc/float.sty) (/usr/share/texmf/tex/latex/psnfss/times.sty) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/keyval.sty) (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg) (/usr/share/texmf/tex/latex/graphics/dvips.def))) (/usr/share/texmf/tex/latex/misc/url.sty) No file template.aux. (/usr/share/texmf/tex/latex/psnfss/ot1ptm.fd) LaTeX Warning: Citation `LAMPORT' on page 1 undefined on input line 65. Overfull \hbox (4.58934pt too wide) in paragraph at lines 65--72 \OT1/ptm/m/n/10 and math-e-mati-cian, in re-ac-tion to his dis-at-is-fa-tion wi th avail- LaTeX Warning: Citation `WIKI-LATEX-TEMPLATE' on page 1 undefined on input line 76. LaTeX Warning: Citation `WIKIPEDIA-LATEX' on page 1 undefined on input line 83. (/usr/share/texmf/tex/latex/psnfss/ot1pcr.fd) (/usr/share/texmf/tex/latex/psnfss/omspcr.fd) LaTeX Warning: Reference `EQ-DEFMEAN' on page 1 undefined on input line 118. LaTeX Warning: Citation `DILLER' on page 1 undefined on input line 123. Overfull \hbox (0.81142pt too wide) in paragraph at lines 121--129 \OT1/ptm/m/n/10 ing or-di-nary prose.[[]]. Be-tween the $\OMS/cmsy/m/n/10 n$\OT 1/pcr/m/n/10 begin\OMS/cmsy/m/n/10 f\OT1/pcr/m/n/10 equation\OMS/cmsy/m/n/10 g <pendulum.eps> [1] LaTeX Warning: Reference `FIG-PEND' on page 2 undefined on input line 144. (/usr/share/texmf/tex/latex/psnfss/omsptm.fd) Overfull \hbox (9.22987pt too wide) in paragraph at lines 153--155 []\OT1/ptm/m/n/10 Despite space re-stric-tions, a bet-ter y-axis cap-tion would LaTeX Warning: Reference `FIG-GAUSS' on page 2 undefined on input line 160. <gaussian.eps> LaTeX Warning: Reference `FIG-GAUSS' on page 2 undefined on input line 165. LaTeX Warning: Citation `OETIKER-NSSITL' on page 2 undefined on input line 170. No file template.bbl. [2] (./template.aux) LaTeX Warning: There were undefined references. LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. ) (see the transcript file for additional information) Output written on template.dvi (2 pages, 7504 bytes). Transcript written on template.log.
Notice that there were many warning messages, this is not a problem. We now have a few more files:
mark.orchard-webb@artemis:~/LaTeX_Template$ ls -l total 308 -rw-r--r-- 1 mark.orchard-webb ADSusers 259563 Jan 14 2004 gaussian.eps -rw-r--r-- 1 mark.orchard-webb ADSusers 17478 Jan 14 2004 pendulum.eps -rw-r--r-- 1 mark.orchard-webb ADSusers 1171 Jan 11 17:45 report.bib -rw-rw-rw- 1 mark.orchard-webb ADSusers 919 Jan 11 18:21 template.aux -rw-rw-rw- 1 mark.orchard-webb ADSusers 7504 Jan 11 18:21 template.dvi -rw-rw-rw- 1 mark.orchard-webb ADSusers 6841 Jan 11 18:21 template.log -rw-r--r-- 1 mark.orchard-webb ADSusers 7095 Jan 11 18:04 template.tex
template.aux is the critical file, we can now use it to generate the bibliography from the \cite{LABEL} commands.
mark.orchard-webb@artemis:~/LaTeX_Template$ bibtex template This is BibTeX, Version 0.99c (Web2C 7.4.5) The top-level auxiliary file: template.aux The style file: unsrt.bst Database file #1: report.bib
This will have created more files:
mark.orchard-webb@artemis:~/LaTeX_Template$ ls -l total 316 -rw-r--r-- 1 mark.orchard-webb ADSusers 259563 Jan 14 2004 gaussian.eps -rw-r--r-- 1 mark.orchard-webb ADSusers 17478 Jan 14 2004 pendulum.eps -rw-r--r-- 1 mark.orchard-webb ADSusers 1171 Jan 11 17:45 report.bib -rw-rw-rw- 1 mark.orchard-webb ADSusers 919 Jan 11 18:21 template.aux -rw-rw-rw- 1 mark.orchard-webb ADSusers 810 Jan 11 18:23 template.bbl -rw-rw-rw- 1 mark.orchard-webb ADSusers 799 Jan 11 18:23 template.blg -rw-rw-rw- 1 mark.orchard-webb ADSusers 7504 Jan 11 18:21 template.dvi -rw-rw-rw- 1 mark.orchard-webb ADSusers 6841 Jan 11 18:21 template.log -rw-r--r-- 1 mark.orchard-webb ADSusers 7095 Jan 11 18:04 template.tex
We can now compile again
mark.orchard-webb@artemis:~/LaTeX_Template$ latex template This is e-TeX, Version 3.14159-2.1 (Web2C 7.4.5) entering extended mode (./template.tex LaTeX2e <2001/06/01> Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, b ahasa, basque, catalan, croatian, czech, danish, dutch, finnish, greek, iceland ic, irish, italian, latin, magyar, norsk, norsk, portuges, romanian, russian, s lovak, slovene, spanish, swedish, turkish, ukrainian, nohyphenation, loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/usr/share/texmf/tex/latex/misc/float.sty) (/usr/share/texmf/tex/latex/psnfss/times.sty) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/keyval.sty) (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg) (/usr/share/texmf/tex/latex/graphics/dvips.def))) (/usr/share/texmf/tex/latex/misc/url.sty) (./template.aux) (/usr/share/texmf/tex/latex/psnfss/ot1ptm.fd) LaTeX Warning: Citation `LAMPORT' on page 1 undefined on input line 65. Overfull \hbox (4.58934pt too wide) in paragraph at lines 65--72 \OT1/ptm/m/n/10 and math-e-mati-cian, in re-ac-tion to his dis-at-is-fa-tion wi th avail- LaTeX Warning: Citation `WIKI-LATEX-TEMPLATE' on page 1 undefined on input line 76. LaTeX Warning: Citation `WIKIPEDIA-LATEX' on page 1 undefined on input line 83. (/usr/share/texmf/tex/latex/psnfss/ot1pcr.fd) (/usr/share/texmf/tex/latex/psnfss/omspcr.fd) LaTeX Warning: Citation `DILLER' on page 1 undefined on input line 123. Overfull \hbox (0.81142pt too wide) in paragraph at lines 121--129 \OT1/ptm/m/n/10 ing or-di-nary prose.[[]]. Be-tween the $\OMS/cmsy/m/n/10 n$\OT 1/pcr/m/n/10 begin\OMS/cmsy/m/n/10 f\OT1/pcr/m/n/10 equation\OMS/cmsy/m/n/10 g <pendulum.eps> [1] (/usr/share/texmf/tex/latex/psnfss/omsptm.fd) Overfull \hbox (9.22987pt too wide) in paragraph at lines 153--155 []\OT1/ptm/m/n/10 Despite space re-stric-tions, a bet-ter y-axis cap-tion would <gaussian.eps> LaTeX Warning: Citation `OETIKER-NSSITL' on page 2 undefined on input line 170. (./template.bbl Underfull \hbox (badness 1881) in paragraph at lines 9--14 []\OT1/ptm/m/n/10 Mark Orchard-Webb. La-tex tem-plate. $\OT1/pcr/m/n/10 http : Underfull \hbox (badness 10000) in paragraph at lines 9--14 \OT1/pcr/m/n/10 / / www . ugrad . physics . mcgill . ca / wiki / Underfull \hbox (badness 10000) in paragraph at lines 16--19 []\OT1/ptm/m/n/10 Wikipedia ar-ti-cle. La-tex. $\OT1/pcr/m/n/10 http : / / en . Underfull \hbox (badness 1062) in paragraph at lines 26--30 \OT1/ptm/m/n/10 2$\OML/cmm/m/it/10 ^^O$\OT1/ptm/m/n/10 . $\OT1/pcr/m/n/10 http : / / www . ctan . org / tex-[]archive / ) [2] (./template.aux) LaTeX Warning: There were undefined references. LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. ) (see the transcript file for additional information) Output written on template.dvi (2 pages, 8388 bytes). Transcript written on template.log.
It takes a keen eye to note the slight decrease in warnings from the first attempt, but fear not ... a second compilation yields:
mark.orchard-webb@artemis:~/LaTeX_Template$ latex template This is e-TeX, Version 3.14159-2.1 (Web2C 7.4.5) entering extended mode (./template.tex LaTeX2e <2001/06/01> Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, b ahasa, basque, catalan, croatian, czech, danish, dutch, finnish, greek, iceland ic, irish, italian, latin, magyar, norsk, norsk, portuges, romanian, russian, s lovak, slovene, spanish, swedish, turkish, ukrainian, nohyphenation, loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/usr/share/texmf/tex/latex/misc/float.sty) (/usr/share/texmf/tex/latex/psnfss/times.sty) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/keyval.sty) (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg) (/usr/share/texmf/tex/latex/graphics/dvips.def))) (/usr/share/texmf/tex/latex/misc/url.sty) (./template.aux) (/usr/share/texmf/tex/latex/psnfss/ot1ptm.fd) Overfull \hbox (4.58934pt too wide) in paragraph at lines 65--72 \OT1/ptm/m/n/10 and math-e-mati-cian, in re-ac-tion to his dis-at-is-fa-tion wi th avail- (/usr/share/texmf/tex/latex/psnfss/ot1pcr.fd) (/usr/share/texmf/tex/latex/psnfss/omspcr.fd) Overfull \hbox (0.81142pt too wide) in paragraph at lines 121--129 \OT1/ptm/m/n/10 ing or-di-nary prose.[[]]. Be-tween the $\OMS/cmsy/m/n/10 n$\OT 1/pcr/m/n/10 begin\OMS/cmsy/m/n/10 f\OT1/pcr/m/n/10 equation\OMS/cmsy/m/n/10 g <pendulum.eps> [1] (/usr/share/texmf/tex/latex/psnfss/omsptm.fd) Overfull \hbox (9.22987pt too wide) in paragraph at lines 153--155 []\OT1/ptm/m/n/10 Despite space re-stric-tions, a bet-ter y-axis cap-tion would <gaussian.eps> (./template.bbl Underfull \hbox (badness 1881) in paragraph at lines 9--14 []\OT1/ptm/m/n/10 Mark Orchard-Webb. La-tex tem-plate. $\OT1/pcr/m/n/10 http : Underfull \hbox (badness 10000) in paragraph at lines 9--14 \OT1/pcr/m/n/10 / / www . ugrad . physics . mcgill . ca / wiki / Underfull \hbox (badness 10000) in paragraph at lines 16--19 []\OT1/ptm/m/n/10 Wikipedia ar-ti-cle. La-tex. $\OT1/pcr/m/n/10 http : / / en . Underfull \hbox (badness 1062) in paragraph at lines 26--30 \OT1/ptm/m/n/10 2$\OML/cmm/m/it/10 ^^O$\OT1/ptm/m/n/10 . $\OT1/pcr/m/n/10 http : / / www . ctan . org / tex-[]archive / ) [2] (./template.aux) ) (see the transcript file for additional information) Output written on template.dvi (2 pages, 8336 bytes). Transcript written on template.log.
This, believe it or not, is a successful compilation! LaTeX is a perfectionist typesetter and grumbles about every slightly too wide or too narrow line.
Viewing
You can view the results of this compilation as follows:
mark.orchard-webb@artemis:~/LaTeX_Template$ xdvi template
Adjust the size and scaling to suit your monitor and marvel. Don't worry if there is a lot of messages about fonts which fly by, xdvi generates new fonts on the fly when they are required, and they are cached for later use.
Printing
You can print using dvips and lpr
mark.orchard-webb@artemis:~/LaTeX_Template$ dvips template This is dvips(k) 5.92b Copyright 2002 Radical Eye Software (www.radicaleye.com) ' TeX output 2006.01.11:1826' -> template.ps <texc.pro><8r.enc><texps.pro><special.pro>. [1] [2<pendulum.eps> <gaussian.eps>] mark.orchard-webb@artemis:~/LaTeX_Template$ lpr template.ps mark.orchard-webb@artemis:~/LaTeX_Template$ lpq wong0110 is ready and printing Rank Owner Job File(s) Total Size active mark.or 35 template.ps 306176 bytes
Publishing as a PDF
Once you have a Postscript version of the document it is trivial to convert this to a PDF using the command ps2pdf.
mark.orchard-webb@aphrodite:~/LaTeX_Template$ ps2pdf template.ps mark.orchard-webb@aphrodite:~/LaTeX_Template$ ls -ltr total 764 -rw------- 1 mark.orchard-webb users 17478 Jan 14 2004 pendulum.eps -rw------- 1 mark.orchard-webb users 259563 Jan 14 2004 gaussian.eps -rw------- 1 mark.orchard-webb users 1171 Jan 11 2006 report.bib -rw------- 1 mark.orchard-webb users 7095 Jan 11 2006 template.tex -rw------- 1 mark.orchard-webb users 799 Jan 13 10:25 template.blg -rw------- 1 mark.orchard-webb users 810 Jan 13 10:25 template.bbl -rw------- 1 mark.orchard-webb users 6594 Jan 13 10:25 template.log -rw------- 1 mark.orchard-webb users 8552 Jan 13 10:25 template.dvi -rw------- 1 mark.orchard-webb users 1050 Jan 13 10:25 template.aux -rw------- 1 mark.orchard-webb users 325955 Jan 13 10:27 template.ps -rw------- 1 mark.orchard-webb users 112818 Jan 13 10:27 template.pdf
