新澳资料

Help Desk

Information Technology

Advanced LaTeX

Using Packages

While writing your document, you will probably find that there are some areas where basic LaTeX cannot solve your problem. If you want to include graphics, colored text or source code from a file into your document, you need to enhance the capabilities of LaTeX. Such enhancements are called packages. Packages are activated with the \usepackage[ options]{ package} command, where package is the name of the package and options is a list of keywords that trigger special features in the package. Almost all packages are provided separately from the CTAN.org repository, but your installation probably has all of those below.

Commonly Used Packages

Name
Description
babel
Write in multiple languages in one document, correct hyphenation for each language, translations for document elements, and commands for easy type input are provided.
multicol
Easily make just a section of text multiple columns.
amslatex
The American Mathematical Society's official math package
textcomp
Enables special symbols like degree, the euro, and others
longtable
Multi-page tables.
graphicx
Enables the insertion and modification of images.

back to top

Document Types

The first command in any LaTeX file determines the format for the entire document.

\documentclass[ options]{ class}

You can either use one of the four standard LaTeX classes, book, report, article, or letter, or a contributed class designed by an individual and contributed to the CTAN.org archive. A good example of a custom class is the 新澳资料 Thesis Template.

Article The article class is perfect for papers and journal articles. It puts the title, author, and date on the first page (if you request a title page) and starts the main body of text on the same page. This class does not allow chapters, but does allow parts, sections, and subsections.
Book This is the most complex class. Unlike the report class, the book class treats odd and even pages differently and prints the chapter or section title on each page in the header. If you are creating a document with many chapters or want it to look like a professional book, you should use the book class. If you find the book class too limiting, you may want to use the memoir class.
Report A report may have chapters. It is a less complicated version of the book class, often used for theses and other short multi-chapter documents. The 新澳资料 Thesis Template is based on the Report class.
Resumes Many LaTeX users have created custom resume classes. By searching Google for "LaTeX resume", you can find a large number of varying designs and styles, including academic CVs and professional resumes. Follow the directions accompanying whatever resume you choose to use.

back to top

Sectioning

For long documents like a thesis or long paper, you may need multiple sections of text. You may have parts, chapters, sections, and subsections. These sectioning commands take care of numbering, formatting the heading, include the section in the table of contents, and put the section title and number in the header at the top of the page. Each sectioning command uses the same syntax:

\section{ title}

If you want the table of contents entry to be different from the section name (often because of length), you should specify the name in square braces:

\section[ TableOfContents_Entry]{ title}

If you want the section unnumbered, you should add an asterix after the command name:

\section*{ title}

However this means it will not be in the table of contents. If you need it in the table of contents, include the following line proceeding the sectioning command.

\setcounter{chapter}{1} This will increment the counter so it will show up properly in the table of contents (ToC).
\chapter*{The First}
\addcontentsline{toc}{chapter}{The First} This adds a chapter called The First to the ToC.
Make sure {subsection} is used for \subsections, {section} for \sections and so on. You don't want the headings to show up at the wrong depth.

The sectioning commands are slightly different for long documents versus short documents. In your thesis you will want to use those for Book and Report classes, but if you're just writing a term paper you will probably want those for the Article class. Remember, you don't need to use all the commands, particularly the \paragraph and \subparagraph; experiment and see what looks best.

Book and Report Classes

Articles

\part

\part

\chapter

\section

\section

\subsection

\subsection

\subsubsection

\subsubsection

\paragraph

\paragraph

\subparagraph

\subparagraph

back to top

Non-numbered Sections and Subsections

If you would like non-numbered sections and subsections in your thesis, and you would also like them to appear correctly in manually-created headings (using \markboth{LeftSideHeading}{RightSideHeading}), add the following to your reedthesis.cls file. 

\newcommand{\nonumsection}[1]{\section*{#1}
\addcontentsline{toc}{section}{#1}             
%\sectionmark{#1}}
\markboth{#1}{#1}}            
 \newcommand{\nonumsubsect}[1]{\subsection*{#1}
 \addcontentsline{toc}{subsection}{#1}}
%\subsectionmark{#1}}

Changing Your Headers and Footers

In A Thesis

There are many modifications people want for their thesis headers. The main ones are: the appearance (without changing what the header actually says) and to change the header to their chapter title instead of the current \section.

To fix the running headers to not be uppercase:

  1. Make a backup of reedthesis.cls (it's good idea to have a backup anyway).
  2. Open reedthesis.cls
  3. Find the header lines:
  4. \fancyhead[RE]{\slshape \leftmark}
    \fancyhead[LO]{\slshape \rightmark}
  5. Change 'em how you like it:
  6. \fancyhead[RE]{\slshape \nouppercase \leftmark} This makes the headers on the right side pages be italic and use lowercase With Capitals When Specified.
    \fancyhead[LO]{\slshape \nouppercase \rightmark} This does the same thing to the left side pages
    or
    \fancyhead[RE]{\scshape \leftmark} The headers will be in S MALL C APS.
    \fancyhead[LO]{\scshape \rightmark}

If you want each of your headers to say the name of the chapter (or something else specific), and not take their name from different sections, back out of the reedthesis.cls and go to thesis.tex.

Then where ever you start a chapter, define your headers, like so:

\chapter{Introduction}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\slshape Introduction}
\fancyhead[LO]{\slshape Introduction}

back to top

In The Article Class

You can make a header using the my headings page style. You will have to use \markboth{ left page header}{ right page header} to specify the header and adjust the spacing of the header with \headheight and \headsep commands. All this is in the preamble.

Here's how the myheadings page style is used to make headings:

\pagestyle{myheadings}
\markboth{This is on the even-numbered page}{This is on the odd-numbered page}
\setlength{\headheight{1 ex}} This specifies the