Documentation:Open UBC/Using LaTeX
LaTeX is a method best known for typesetting mathematical equations but it can also be used to typeset an entire document. Its plain text commands allow authors to write a variety of symbols quickly and allow authors control over formatting and alignment. Additionally, LaTeX is free, has good documentation, and has a large active community which has developed a range of freely available modifications called "packages".
LaTeX can be used to create:
Mathematics | Chemistry | Phonology | Music | Plots |
The default distribution of LaTeX offers over 10,000 symbols which allows for typesetting most equations. | LaTeX is capable of handling basic chemical equations easily, but for more complex notation there are several packages. | There are many packages available for phonologists looking to create phonetic transcription, vowel charts, syntactic trees, and more. | Written music has a distinctive appearance, very unlike written text. LaTeX provides a way to describe music by what we are able to type and the output resembles printed music closely enough that we can see the correspondence. | LaTeX allows for programming plots and graphs into documents. You provide the input data/formula and the packages do the rest. |
Jump to a section: Faculty Example | Get Started | Support | FAQ
How are faculty using this tool?
Vishakha Monga created Inorganic Chemistry for Chemical EngineersThis Pressbook introduces students to the basic principles of inorganic chemistry and links them with current applications relevant to a chemical engineer. Read More... |
Jonathan Ichikawa adapted forall x: UBC editionThis book is an introductory logic textbook specifically adapted for use in UBC classes. Read More... |
Joel Feldman, Andrew Rechnitzer, and Elyse Yeager created CLP Calculus TextbooksThe CLP calculus textbooks and problem books were written for standard university Calculus 1, 2, 3 and 4 courses at the Department of Mathematics, UBC. Read More... |
How do I get started?
Overleaf
Similar to other markup languages like HTML, the styles, contents and layout in a LaTeX document are written using tags or commands. If you want to use LaTeX to create an entire document or project, you will need to use a program or platform which will recognize and interpret LaTeX tags and commands into a readable document. We recommend the website Overleaf which provides a platform for you to begin creating your LaTeX document. Overleaf provides many different templates to get your started with your project, as well as in-depth guides on how to write and use LaTeX. If you do not want to use Overleaf, they provide a list of alternate options.
Here is a brief video on how to get started with LaTeX in Overleaf:
Pressbooks
If you don't want to create your whole document using LaTeX, or want a more intuitive or familiar interface for creating a text, we recommend using Pressbooks. Pressbooks is an online platform for creating and publishing open textbooks available at UBC through BCcampus. Pressbooks has an optional plugin called QuickLaTeX which enables the use of LaTeX within the editor. Once QuickLaTeX has been enabled, there are several ways you can mark out LaTeX code within the chapter. One way is to:
- At the top of the page write [latex] to let Pressbooks know that there is LaTeX code on this page
- Add a a dollar sign ($) before and after the LaTeX or,
- Put the formula on a new line by adding the following to the beginning and end of you our LaTex equation:
\begin{equation}
\end{equation}
For an in-depth explanation and examples, read Equations and Formulas: How to Use LaTeX
Here is a brief video on another way to use LaTeX in Pressbooks:
Jupyter Notebooks
Another textbook creation platform used at UBC is Jupyter Notebooks, which allows you to create and share documents that contain live code, equations, visualizations, and narrative text. To add LaTeX to your Jupyter Notebook, put a dollar sign ($) before and after the LaTeX text.
Here is a brief video on how to use LaTeX in Jupyter Notebooks:
Training
Here is a list of various LaTeX tutorials and guides that can help you get started learning how to write LaTeX
- Free Online Introduction to LaTeX (Overleaf)
- Learn LaTeX in 30 mins (Overleaf)
- LaTeX Tutorials
- LaTeX For Beginners Workbook [PDF]
- The Not So Short Introduction to LaTeX 2e (Or LaTeX 2e in 139 minutes) [PDF]
LaTeX Packages
While the basic symbols available in LaTeX cover most of the bases for math equations, you may find that you need a symbol or need to write something that isn't included in basic LaTeX. This is where packages come in. Packages are add-on features for LaTeX that contain extra LaTeX commands and programming which add new styling features or modify those already existing.
To add a package to your LaTeX project, you will need to insert the code in the preamble.
\usepackage{name-of-package}
The preamble is the first section of an input file, before the text of the document itself, in which you tell LaTeX the type of document, and other information LaTeX will need to format the document correctly. Adding packages in Pressbooks can be done through the settings menu. Jupyter Notebooks uses MathJax to render LaTeX and cannot use packages.
What support is available?
UBC Library is able to provide consults and support for Pressbooks projects which involve LaTeX.
BCcampus offers monthly LaTeX Learning Community sessions for B.C. and Yukon post-secondary institutions where you can bring your LaTeX questions and problems to consult with experts.
Resources
Here is a list of resources for writing in LaTeX that you might find helpful
- Symbol Lists
- Commonly used LaTeX symbols
- Symbols in LaTeX (6-page list) [PDF]
- Comprehensive LaTeX symbol list [PDF] which includes symbols available through various packages
- Guides and Templates
FAQ
Attribution
- Adapted from Using LaTeX in Pressbooks by Laura Greenstreet (CC-BY-SA)
- Adapted from LaTeX preamble on LaTeX Wiki (CC-BY-SA)
- Description of music was adapted from Polyphonic or Instrumental Music with M-Tx and MusixTeX on Overleaf (CC-BY)
- Description of plots was adapted from Pgfplots package on Overleaf