Module 4: Cloud-based LaTeX Environments


Learning Goals

The learning goals for this module include:

  • Understand the benefits of using cloud-based LaTeX environments.
  • Setup an account on Overleaf and create a LaTeX document.
  • Learn where to obtain templates and packages designed for teachers.


Before You Start

  1. Recall that LaTeX can be used not just to insert math equations, but to format entire documents. LaTeX is used for scientific reports, books, resumes, slideshows, and really any other type of document. Check out the Overleaf LaTeX CV Gallery for examples of how LaTeX can be used to create resumes.
  2. Scan, but do not read all of, the LaTeX Wikibooks entry on installing LaTeX. The steps on this page, and other configuration required to run LaTeX on your local machine, is exactly what we are avoiding by looking to cloud-based LaTeX systems.
  3. Set up a free account on Overleaf.

Cloud-based LaTeX Environments

To create full LaTeX documents, one option is to install the LaTeX processor on your local machine, write your documents using a text editor, and compile them to generate pdf or other document formats. An alternative is to use one of several online LaTeX systems. Overleaf and CoCalc, for example, offer free accounts that allow you to create and edit LaTeX documents, providing editors that show both the LaTeX code and the rendered document side by side.

Basic Document Layout

At its simplest, a LaTeX document is very simple, as shown below.


   \documentclass{article}
   \usepackage[utf8]{inputenc}

   \begin{document}
   \noindent
   Euler's formula shows the surprising relationship between 
   the exponential function and the sine and cosine functions.
   \[      
      e^{i\theta} = \cos(\theta) + i\sin(\theta)
   \]
   When \(\theta = \pi \), Euler's formula provides 
   the identity \(e^{i\pi}=-1\).
   \end{document}
	

The example above shows many of the elements of a typical LaTeX document:

  • Preliminary commands to identify the document as a LaTeX document and identify its document class.
  • Package imports that instruct LaTeX what groups of commands will be used (the ones shown are minimal).
  • Some formatting commands, like the \noindent shown.
  • Plain text that will be rendered as typed.
  • Inline mathematics, placed inside the backslash-round-bracket pattern shown.
  • Display equations, placed inside the backslash-square-bracket pattern shown.

Exercise 2: Create a "blank" document project within Overleaf. Remove all text in the document and replace it with the example above. Recompile and note the difference between the inline math and displayed equation.


Exercise 3: Create a "blank" document project within Overleaf. Somewhere between the \begin{document} and \end{document}, insert a LaTeX command that you have learned, in between the backslash-square bracket pattern as shown above.


Advanced Options

Some notation and formatting requires you to provide extra instructions to LaTeX. As the formatting gets more complex, the LaTeX file will start to look more like a computer program than a document. If you end up using LaTeX as a complete formatting system, you will need to learn more about using packages, defining macros, and other advanced features.

For example, the \cfrac command and the align environments shown in module 2 require the amsmath package.


   \documentclass{article}
   \usepackage[utf8]{inputenc}
   \usepackage{amsmath}
   \begin{document}
   \noindent
   \[
     \cfrac{1}{1+\cfrac{1}{1+x}}
   \]
   \end{document}
	

Additional packages are included via the \usepackage commands, which must be added prior to the the \begin{document} directive.

Exercise 4: In one of your documents, include a use of the \cfrac command. Note the error that occurs when you compile this. Add the \usepackage{amsmath} command in the right part of your document, and see that it resolves the error.


How Will I Use This?

Depending on your level of interest, you can use environments like Overleaf in various ways:

  • Use the environment like one of the LaTeX equation editors we saw previously - allowing you to create more involved math snippets that can be captured and imported as images into other documents.
  • Produce simple handouts that do not require extensive formatting, downloaded and distributed as pdf files
  • Create complete well-formatted notes, quizzes, tests, and slideshows using special packages and custom formatting.

Useful Packages and Templates

As a teacher, you may be tempted to use LaTeX to create assignments, tests, and other documents that might require special formatting. There are several LaTeX classes and templates that have been created to help do this. A few places to look for these kinds of resources include:


Learn More

Did we mention that LaTeX is an established technology? At this point, you're ready to take a look at a LaTeX overview from (gasp!) 1995: David R. Wilkins's Getting Started with LaTeX covers many aspects of document setup and formatting not discussed in this workshop. Another place to learn more is the Overleaf documentation centre, which has helpful information on LaTeX and the Overleaf platform. The full documentation for amsmath is a great place to learn about the advanced formatting options available in that package.


Learning Checklist

Before moving on to the next module, take a moment to review the learning checklist.





If there were any items in the checklist that you did not complete, consider reviewing this page again before moving on.


References

LaTeX/Installation. (2019, February 15). Wikibooks, The Free Textbook Project. Retrieved 02:23, March 20, 2019 from https://en.wikibooks.org/w/index.php?title=LaTeX/Installation&oldid=3516765

Lees-Miller, J (2017). An Interactive Introduction to LaTeX. Slides. Retrieved on March 21 from: https://learn.sharelatex.com/learn/Free_online_introduction_to_LaTeX_(part_1)

Overleaf Inc. (2019). Overleaf Cloud-based LaTeX Document Preparation Software. Retrieved on March 18, 2019 from https://www.overleaf.com/about

SageMath, Inc. (2019). CoCalc Online LaTeX Editor Software. Retrieved on March 20 from https://cocalc.com/doc/latex-editor.html

Watson, S.S. (2013). LaTeX Resources for Teachers, webpage. Retrieved March 7, 2019 from http://math.mit.edu/~sswatson/latexforteachers.html

Wilkins, D.R., (1995). Getting Started with LaTeX. Webpage. Retrieved February 26, 2019 from https://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/GSWLaTeX.pdf