The three most commonly used standard document-classes in LaTeX include: article
, report
and book
. A number of global options allows customization of certain elements of the document by the author. Different document-classes might have different default settings. The following post illustrates available options with figures, provides alternatives and highlights the default option for each document-class.
To change the default behavior, the option is provided as an optional parameter to the documentclass
command.
\documentclass[option1, option2, etc.]{article}
Font size
LaTeX knows three standard font sizes:
10pt (default)
11pt
12pt
Other global and local font sizes are available through various packages.
The following example sets the global document font size to 12pt. The picture below compares the three LaTeX standard font sizes.
\documentclass[12pt]{article} \usepackage{blindtext} \begin{document} \blindtext \end{document}
Paper size and format
Different regions of the world use different standard physical paper sizes. Available are:
a4paper (default)
letterpaper (default in some distributions)
a5paper
b5paper
executivepaper
legalpaper
The following example compares (from left to right): legal, A4, Letter and A5.
\documentclass[a4paper]{article} \usepackage{showframe} \begin{document} \begin{center}{\Huge A4 paper}\end{center} \end{document}
The geometry package provides similar options and additional flexibility for paper size and margins.
Draft mode
Setting the draft
option will speed up typesetting, because figures are not loaded, just indicated by a frame. LaTeX will also display hyphenation (Overfull hbox warning) and justification problems with a small black square. Delete the draft
option or replace it with final
in the final document version.
Multiple columns
onecolumn (default)
twocolumn
By default, text is typeset in a single column (onecolumn
). LaTeX provides an easy way to switch to two columns through the document-class option twocolumn
.
The multicol package allows creating more than two columns globally as well as locally.
Formula-specific options
fleqn
: left-alignment of formulasleqno
: labels formulas on the left-hand side instead of right
These are two independent options manipulating the alignment and label position of formulas.
The top figure illustrates the default case with neither option set. The bottom figure shows how formulas are typeset when both options, fleqn
and leqno
, are set.
Landscape print mode
The landscape
option changes the page layout to landscape mode. This, however, does not change the page margins accordingly (first page in figure), which is why for landscape documents with landscape content the pdflscape or geometry packages (second page in figure and code) are more suitable.
\documentclass[a4paper]{article} \usepackage{blindtext, showframe} \usepackage[landscape]{geometry} \begin{document} \blindtext \end{document}
Single- and double-sided documents
oneside (default for article and report)
twoside (default for book)
In single-sided documents (oneside
), the left and right margins are symmetric and headers are exactly the same on every page. In other words, the document does not distinguish between inner and outer margin. Twoside, on the other hand, generates double-sided content. The outer margin (even page: left; odd page: right) is wider by default (see figure below). It might appear that the header “switches” sides, but that because they are placed with respect to the margins. The twoside
option is usually set for bound texts such as theses or books.
\documentclass[twoside]{report} \usepackage{blindtext, showframe, fancyhdr} \pagestyle{fancy} \begin{document} \chapter{First chapter} \section{First section} \blindtext \clearpage \Blindtext \end{document}
Titlepage behavior
notitlepage (default for article)
titlepage (default for report and book)
The option titlepage
ends the page after \maketitle
and restarts on the next page. In article
, the content starts right after \maketitle
. The titlepage
option is quivalent to:
\maketitle \clearpage
The example below illustrates the default behavior of article
.
\documentclass{article} \usepackage{blindtext} \title{This is an article} \begin{document} \maketitle \begin{abstract} \blindtext \end{abstract} \end{document}
Chapter opening page
openany (default for report)
openright (default for book)
Finally, the option openright
always starts a chapter on the right (odd pages), leaving one page blank in case the last paragraph of the previous chapter ended on an odd page. It only works and makes sense with the twoside
option set. The openany
option starts the chapter on the next page (even or odd).
The openany
, openright
options are not available in article
as it does not support \chapter
!
\documentclass[twoside, openright]{report} \usepackage{blindtext} \begin{document} \chapter{First chapter} \blindtext \chapter{Second chapter} \blindtext \end{document}
4d43
Very interesting post!
I use LaTeX for almost everything, and I discovered new things thanks to your post!
tom
I’m glad parts of the post were new to you. Thanks for the comment!
ae00505
Thanks Tom, you are a gem. You helped me a lot today.
dror
Great post!
tom
Thanks! 🙂
Nilson
Hi,
How to code many authors and one address without repeating the address in the text of article?
I code this:
Is there another way to code latex and get only one address shared by many authors???
tom
Hi Nilson,
Thanks for your question. I gave it a try, take a look at the result and let me know what you think. Btw. I removed all special characters and email addresses.
Omar
thank’s
yogan
Could u pls help me, i used
\documentclass[chap, 12pt, nocenter]{thesis}
for my thesis but chapter not printingthanks
tom
Hi Yogan,
I assume this is the document class you are referring to. Please provide a minimal working example. The code below prints chapter headings correctly. Note, the option
chap
doesn’t exist. Did you meanchapterbib
instead?Cédric M. Campos
I believe it is [oneside|twoside] not [onepage|twopage].
tom
Fixed, thanks!
Raphael
Thanks for the illustration of the documentclass options!
‘openright’ always starts a chapter on the right (odd page). Why is this default for scrbook, why does it make sense? I’m interested in the advantages of ‘openright’ (disadvantages would be the waste of an even page and the waste of paper). Is there any?
Or is ‘openright’ only a matter of taste?
tom
I’d say it’s a matter of style. Most decent books start new chapters on an odd page and therefore it makes sense that
openright
is the default. If you prefer a document without blank pages between chapters, either use the document classscrreprt
or change it through theopenany
option.Cheers, Tom.
Volker
Very good help.
Thank you very much
Cheers, Volker
csg
Hi, I have a question as well. I am using
\documentclass[nopreprint,times,3p,final]{elsarticle}
, but still is appearing in footnote the preprint. What would be the solution?tom
Hi there,
I assume you use the elsarticle class for something other that submitting an article. According to the documentation, there is no option
nopreprint
. My suggestion is to download the class file and manually remove the line that says “Preprint submitted to …” (on line 451). Then, place the class file in your project directory.HTH,
Tom
csg
Thanks, I give a try now.
A
Hi,
First off the post was very helpful.
Second, I like to double space after every period. I know normally LaTex formats everything so it always shows up as one space no matter how many you type in.
I heard there was an option you could put in brackets after the document class (ie
\documentclass [in here] {article}
) but I don’t know what could be.Is this true or is there some other way I could add a double space after each period?
Thanks so much!
tom
That’s an interesting question, which I can’t remember having seen before. Apparently, single spacing is referred to as ‘french spacing’. So, by adding the following command to your preamble, you’ll get double spacing between sentences:
See here for more details.
Best, Tom.
Shakthi
what is meant by \document class{ws-dmaa}.is there any required software to run this?
tom
Hi Shakthi,
It’s the name of the class file. Look for a
ws-dmaa.cls
file and place it in the project folder.Best, Tom