Open your LATEX editor (or log into your online service) and create a new, empty document (delete any auto-template material)
Make sure your editor is set up to use LuaLATEX to process your documents
Copy and paste the text below. Make sure you get all of it, and don’t change anything yet
\documentclass{article} \begin{document} Hello, world! \end{document}Save the document as demo.tex in your Documents folder or wherever you normally keep your documents (Overleaf, TEXPage, and Prism may already asked have for the name in step 1 above)
Click on the button or menu entry or keystroke shortcut which formats the document. See Figure 2.2 below for how different editors label this button.
If the WYSIWYGpreview does not open automatically for you, click on the or toolbar item (usually next to the icon), or use any PDF viewer to open demo.pdf
Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document
Formatting Information — An introduction to typesetting with LATEX
Chapter 1: Writing documents
Section 1.4: Quick start for the impatient
In this section…
If you already know all about editors and plaintext files and markup and how to run programs, and you know that LATEX is already fully installed on your system, including an editor that you know how to use, or you prefer to use Overleaf, TEXPage, or Prism, or another of the online LATEX services … you’d probably like to type something in and see LATEX do its job, so here are two tasks: the example ‘Short demo’ below and the example ‘Example article’ below.
1.4.1 Short demonstration of LATEX
Exercise 1.4 — Short demo
If you encounter any errors, it means you do need to read the rest of this chapter after all. There is a list of common error messages in § B.3.1 below. You need to fix any errors in your document and click on the button again.
If you haven’t yet learned about all the things mentioned at the start of this section, by all means try these examples now, but treat them as part of the learning experience. In § 1.5 below you can read more about the instructions LATEX uses.
In this little example there are three LATEX instructions you can see in the document, along with the text ‘Hello, world!’:
\documentclass{article} tells LATEX that this document is an article;
\begin{document} marks the start of your text;
\end{document} marks the end of your text.
These three instructions are COMPULSORY: every LATEX document MUST have them (although article can be replaced by a different document class name as appropriate).
1.4.2 A longer demonstration of LATEX
the example ‘Example article’ below is a longer example with more of the features you would expect in a document: title, author, sections, paragraphs, lists, figures, etc.
Exercise 1.5 — Example article
Make sure your editor is set up to use biber (see (this section))
Download the document https://latex.silmaril.ie/formattinginformation/quickstart.tex and open it in your LATEX editor.
In the same directory (folder), also download the imagehttps://latex.silmaril.ie/formattinginformation/texstudio.png
Typeset the document. This will generate a draft and a bibliography file.
Process the bibliography with biber and reprocess the document
View the document
Your editor should run biber for you automatically: if not, type the command biber quickstart in a Command window in the same folder.
This example has been designed to let you see the effect of changing the appearance and layout without having to modify the text at all — just by changing the packages used.
Commands used in the example
In the \documentclass command, change a4paper to letterpaper to get the document formatted for Letter size paper as used in the USA instead of A4 (see § 2.1.3 below for details of paper sizes)
Also in the \documentclass command, change 12pt to 11pt to see the document in 11pt type instead of 12pt. Or change it to 10pt for 10pt type. For other size options, see § 2.1.3 below;
Below the long line of %%% signs (around line 21) is a list of \usepackage commands. Each package affects how the document is typeset. Uncomment the lines one by one by deleting the % sign at the start of the line. This makes the line active, so you can reprocess the document each time to see the formatting effect in your PDF viewer:
parskip changes the traditional ‘book’ style of indented paragraphs with no gap between them to the ‘office’ style of no indentation but a gap between paragraphs;
geometry sets the page layout. Here, we adjust the page margins to 2.5cm (you could also use 1in or another dimension)
setmainfont sets the main (Roman, serif) font for the whole of the document text. The Tinos typeface is supplied with LATEX so it should already be on your computer;
setsansfont sets the sans-serif font if you want to use one. The Cabin typeface is supplied with LATEX so it should already be on your computer;
sectsty affects how section headings behave and how they look. If provides the \allsectionsfont command which we use here to switch all section heading fonts to the sans-serif family;
datetime2 sets the way dates and times are shown: look at the date on the front page to see it change. I’m in Ireland, so I use en-IE but you can change that to your two-letter (lowercase) ISO 639 language code and your two-letter (upper-case) ISO 3166 country code. The \DTMlangsetup command is used to omit the ordinal indicators (st, nd, th, etc)
enumitem controls the formatting of numbered and unnumbered lists (despite its name). The \setlist command is used here to set top-level itemized lists to use a ring with a dot as the bullet;
ragged2e provides a form of ragged-right and ragged-left typesetting that allows hyphenation (traditional \raggedright prevents hyphenation)
hyperref turns URIs into links in the PDF. The \hypersetup command specifies what colour they will be. Because hyperref makes some deep-rooted changes inside LATEX to handle links, it should always be the last package loaded.
Below this block is the quickstart package which does a combination of these things, but before uncommenting it, you must re-comment (add back the % sign) to the ones you have been experimenting with, to stop them interfering with the quickstart package.
Lastly, there is a list of some of the many document classes for articles for various journals and publishers. Feel free to substitute them for article in the \documentclass line and see what they do when re-typeset.
Be aware that for proper use, you need to read the documentation for the class you are interested in, as they provide many extra commands for their specific journal.
In the next section we’ll look at how the two types of LATEX commands work, and see what the commands used in the example do.
