25.2 Basic LaTeX Template

20200602 LaTeX is a language for programming, like R—programming over words and sections and chapters and page layout, rather than programming over data. It is what we call a markup language and has its own collection of commands that tell the LaTeX software what to do. Within RStudio when we create a new knitr (Xie 2021) document a skeleton of LaTeX commands will be automatically inserted into the document for us. From this initial script we can readily produce well formatted reports and presentations.

Once we have a new text document with a filename extension of .Rnw we will enter the LaTeX commands intermixed with the text of our narrative intermixed with the R commands performing the data wrangling and the analyses we perform.

\documentclass{article}

\begin{document}

\end{document}

This is the most basic of documents—something we often call the Hello World example, though perhaps we would want to include the string Hello World between the begin and end of the document.

\documentclass{article}

\begin{document}

Hello World.

\end{document}

LaTeX provides an extensive collection of commands including the basics like highlighting text (for example, \bold{...} or \italic{...}) and creating a list of items:

* Text for the \bold{first} item.
* Text for the \italic{second} item.
* ...

We will see many examples as we proceed through this chapter and there are very many guides to LaTeX available on the Internet. Our aim is to quickly be comfortable with using LaTeX and not to let it get in our way, recognising it as a very powerful language.

References

———. 2021. Knitr: A General-Purpose Package for Dynamic Report Generation in r. https://yihui.org/knitr/.


Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.