LaTeX Typesetting – Document Structure
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Following on from the initial post about creating a document using LaTeX we need to consider the structure of the document, i.e. headings and page layout.
Fast Tube by Casper
Document Class
The document class is a template that specifies the appearance of different components of a document, e.g. the font and size of headings. The most commonly used classes are article, which corresponds to a typical layout for a journal article, report or book for longer documents and letter.
documentclass{article}
When selecting a document class it is also possible to provide some options, including the size of the font – 10pt, 11pt or 12pt. We could also use the twocolumns option to had two columns of text.
documentclass[12pt]{article}
The paper size can also be stated in the options – a4paper etc.
Page Style
There are some basic page styles available in the main document classes. These include plain which has the page number in the footer only or empty where there is nothing in the header or footer.
pagestyle{empty}
These can be changed during a document, e.g. there might be one page that has a picture but you don’t want the page number to be shown as it might obscur some other useful information.
Page Numbering
The default option is arabic numerals, but we could also use (upper or lower case) Roman numerals in the front part of the document before reverting to using the Arabic numerals.
pagenumbering{Roman}
Parts of a Document
A document can be divided into various pieces, known as chapters, sections, subsections and so on. To do this in LaTeX we use the commands chapter, section and subsection with the name of the section in curly brackets.
section{A Section Heading}
Chapters appear in books and reports but not in the article class, while the letter class is a lot simpler than these other classes. In an article the numbering for sections is 1, 2, 3 and so on and the subsections are 1.1, 1.2, 1.3 and onwards.
Other useful resources are provided on the Supplementary Material page.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.