ROUGH DRAFT authorea.com/6868
Main Data History
Export
Show Index Toggle 27 comments
  •  Quick Edit
  • How To Write LaTeX (For Beginners)

    Authorea Help

    This LaTeX cheatsheet is adapted from “A Super Brief, Yet Super Awesome, LaTeX Cheat Sheet” by Rick Freedman. Please note this cheatsheet refers to Authorea’s support of Pandoc. But Authorea currently supports a much broader subset of LaTeX, thanks to our integration with LaTeXML. Check out this document to see how to switch your default format to LaTeXML and what you can do with it.

    A Brief Introduction\label{intro}

    LaTeX is a programming language that can be used for writing documents. It is especially useful for the mathematics and sciences fields due to its ease of writing special symbols and equations while also making them look good. For those not using special characters LaTex requires minimal learning, making it a very approachable language. Most textbooks are actually written in LaTeX.

    In this cheat sheet, we discuss some of the basics for writing documents in LaTeX. In particular, we will focus on web documents and introduce a subset of LaTeX which safely works on the web. Why? LaTeX is primarily intended for the printed page, not the web. But more and more scientists are writing content on the web, and they need to use mathematical notation. This cheat sheet presents LaTeX notation which converts easily to HTML and works well on platforms like Authorea under the Pandoc rendering environment. Note: Authorea currently supports a much broader subset of LaTeX, thanks to our integration with LaTeXML. Check out this document to see how to switch your default format to LaTeXML and what you can do with it.

    Formatting Commands\label{formattingCmds}

    In LaTeX, formatting is done by the use of specific commands. These commands will format text in the desired way when the text is rendered. In particular, there are two ways formatting is done:

    In-Line Formatting Commands\label{inlineFormatCmds}

    • \( \setminus \)textbf{Text to write in bold}

    • \( \setminus \)textit{Text to write in italics}

    • \( \setminus \)sout{Text to strike out}

    • \( \setminus \)verb|Code block to verbatim |

    • \( \setminus \)href{http://url.com}{Link text}

    Best of all, these can be placed within each other (like nested blocks of code). For example, here’s some italic text with a strikeout.

    Environments\label{envFormattingCmds}

    These formatting commands have two pairs of commands: \begin{format command} and \end{format command} . Anything between a \( \setminus \)begin and \( \setminus \)end with the same format command will be formatted. Some examples include lists and verbatim:

    • Lists. Each entry is indicated by the \item command. There are many types of lists including:

      1. itemize Bulleted lists

      2. enumerate Numbered lists (like this one!)

      3. description Labelled lists.

    • Quote. The quote environment is for... quotes.

      The trouble with quotes on the Internet is that you never know if they are genuine. —Albert Einstein

    • Verbatim. The verbatim environment types everything character for character, including commands. This is great for typing program code (please note that the listings package also works as described here) function foo(items) { var i; for (i = 0; i < items.length; i++) { alert("Hello World" + items[i]); } }