You are currently browsing the monthly archive for January 2009.

It’s easy and convenient to use just one .tex file when writing short documents. But for anything larger than, say, 10,000 words, I tend to divide the document into smaller parts so each chapter is its own .tex file.

For example, you might be writing a thesis that includes three chapters (introduction, results, conclusion) and an appendix. These are called introduction.tex, results.tex, conclusion.tex and appendix.tex.

These four files are like any other .tex file except you omit the preamble (\documentclass, \usepackage, etc.) and the \begin{document} and \end{document} commands. The reason you don’t include these commands is that they are included in your main file, thesis.tex, ensuring that your formatting is consistent throughout the final output document. This also means that page numbers and footnotes will be numbered correctly all the way through.

Which Commands to Use

There are two commands you can use in your main file, thesis.tex, to insert your four chapter files: \include and \input.

The \input command slots each chapter in straight after the one before it without any pagebreaks, while \include works by starting each new chapter on a new page and ends it with a clearpage command. (Thanks to the latex-community forum for help on explaining this to me!)

In other words, ‘natural candidates for \include are whole chapters of a book but not necessarily small fractions of text,’ for which \input would be more appropriate. (Quotation from The LaTeX Companion.)

Your thesis.tex file would therefore look something like this:

\documentclass{article}
\usepackage{semtrans}

\begin{document}

\title{My Thesis}
\author{John E. Smith}
\maketitle
\clearpage

\include{introduction}
\include{results}
\include{conclusion}
\include{appendix}

\end{document}

Note: your four files (introduction.tex, results.tex, conclusion.tex and appendix.tex) must be saved in the same folder as thesis.tex, otherwise it won’t work.

Omitting Files

If you wanted to produce a PDF from the file thesis.tex without the appendix, all you have to do is comment out that particular \include command (you just add a % at the beginning of the line): %\include{appendix}

Useful Links

Students and staff at the University of Cambridge may be interested in the following courses on offer this term:

  • 10-11 February LaTeX: Introduction
  • 13 February LaTeX Follow-up Practical Using TeXshop on a Macintosh

See http://www.cam.ac.uk/cs/courses/timetable.html for course descriptions and booking information.

Eligibility: The standard programme of short courses run by the Computing Service is aimed at the staff and students of Cambridge University. Others may also be eligible to attend if from certain related institutions. For details see: http://www.cam.ac.uk/cs/courses/genreg.html#charging

I would encourage readers of this blog to submit information about other LaTeX courses being run near you. You can do this by adding a comment to this post.

A great deal of academic writing is convoluted and dull (well, at least what I’ve been reading), and the American trend of using ungrammatical jargon to dress up second-rate thinking is sadly spreading to the UK.

But it doesn’t have to be that way – Nabokov’s scientific writings on butterflies have a lyrical quality, while Russell’s works on philosophy are clear and concise.

I have found George Orwell’s rules of writing to be very helpful:

  1. Never use a metaphor, simile, or other figure of speech which you are used to seeing in print.
  2. Never us a long word where a short one will do.
  3. If it is possible to cut a word out, always cut it out.
  4. Never use the passive where you can use the active.
  5. Never use a foreign phrase, a scientific word, or a jargon word if you can think of an everyday English equivalent.
  6. Break any of these rules sooner than say anything outright barbarous.

From Politics and the English Language (1946) – http://www.k-1.com/Orwell/index.cgi/work/essays/language.html

Bertrand Russell also wrote a short essay entitled How I Write (1954) – http://www.davemckay.co.uk/philosophy/russell/russell.php?name=how.i.write

Useful Links

Using fancyhdr

Using fancyhdr

This package allows you to customize headers and footers in the LaTeX document.

You can find comprehensive information on this package in The LaTeX Companion.

Here I’ll explain how to make a simple header showing your name and the date.

This is what you need to include:

\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancyplain}

\begin{document}

\lhead{John E. Smith}
\rhead{\today}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque ut ante pulvinar mauris interdum euismod. Aliquam dui tellus, blandit at, tincidunt ac, feugiat id, nibh.

Simple Header

Simple Header

Phasellus id metus. Aliquam erat volutpat. Donec fringilla. Donec euismod, velit quis adipiscing hendrerit, enim eros tempor mi, a hendrerit ipsum eros eget leo.

\end{document}

Here is the output PDF of the document: SimpleFancyhdr.pdf

The fancyhdr package was created by Piet van Oostrum.

Useful Links

Follow

Get every new post delivered to your Inbox.