Using Pressbooks

Using LaTeX to Render Formulas


Transcript of video

LaTeX is a programming language specifically built to properly input, format, and display mathematical formulas.

In this video, we are going to go over how to type and render formulas using the BCcampus custom version of LaTeX in Pressbooks. LaTeX can be inputted in both the “Visual” and “Text” view. Check out the video description box below for LaTeX additional resources.

LaTeX uses special keywords to enable Pressbooks to differentiate LaTeX equations from normal text

“ $latex” is used to begin an equation. “$” is used to end an equation. Another way to open and close an equation is to use “” to open, and “” to close.

When writing equations, we run into situations where we must use brackets to separate different equations. Left and right squiggly brackets must be used to open and close a function. Otherwise an error message will be displayed in the “Chapter” view. We will discuss error messages later in this tutorial.

Inputting formulas is quite straightforward for characters that are found on a standard keyboard. All formulas are inputted between and . Let’s input the linear equation, y=mx + b in LaTeX.

First we must start with opening and closing our equation. In the “Visual” view, type “$”. Now, move your cursor in between “latex” and “$” and begin typing the linear equation: y = mx + b.

y = mx + b is what you should have in Pressbooks.

Then “Update” the chapter. And refresh the book page. You will see that the equation is displayed with a look similar to what you get in traditional math textbooks.

Now you might ask, “If I need to use the square root character, and my keyboard does not have a key for that function, what do I do now?”

LaTeX has a built in library of special characters, symbols, and functions aimed specifically at addressing this issue. This video will not go through all of these symbols because there are just too many of them. There are many guides available on the internet which addresses this topic. We recommend you to check out BCcampus’ Pressbooks LaTeX Guide which provides specific workarounds for certain functions.

Similar to formatting YouTube videos from Pressbooks, we can use text align tools: “Left”, “Right”, and “Centre Align” to align a LaTeX equation. Let’s “Centre Align” our linear equation, “y = mx + b”.

Place your cursor on the linear equation and select “Centre Align” from the toolbar. Go to the “Book” view and refresh the page. You will see that your equation is now centre aligned.

There are two main error types: “You must stay in inline math mode Error” and “Formula does not parse Error”. When working with LaTeX in Pressbooks, it is more common to see a “Formula does not parse Error” than “You must stay in inline math mode Error”.

“You must stay in inline math mode Error” occurs when the opening and closing of LaTeX equations do not match. Remember “$latex” is for opening and “$” is for closing whereas “” is for opening and “” is for closing.

“Formula does not parse Error” is an error message that LaTeX displays when there is something wrong with the equation. This could be due to a variety of reasons from misspelled special characters to forgetting to close brackets.

One method to reduce the amount of errors is to always open and close brackets as soon as possible in order to eliminate missing brackets.

There are times when the equation is correct yet LaTeX will not render it in the “Chapter View”. In this case, retype the equation and then delete the old equation.

So there you go! You now know how to LaTeX to render formulas.

Comments are closed.