Latex has two modes: equation mode and text mode. Notion's in-line and block equations are, of course, in equation mode by default. This means that you can insert math code such as \\frac{2}{2}
for $\frac{1}{2}$ or \\lim\\limits_{n\\to\\infty}f(x)
for $\lim\limits_{n\to\infty}f(x)$ and it will render.
However, if you try to write text it will come out in italics and none of the spaces will render, for instance
$$ I just wrote some text here and it looks awful $$
You could manually insert spaces in math mode using a backslash \\
,
$$ but\ this\ is\ very\ annoying\ to\ do! $$
Instead, we can toggle text mode and we don't have to worry about spaces not showing up.
There are various ways to toggle text mode inside a LaTeX equation. The first is by putting your text inside a \\text{}
tag. For instance, the code on the left renders as the block on the right:
\\text{This is some text}
$$ ⁍ $$
Inside \\text{}
, you can no longer write equation code, but you can toggle back into equation mode either
\\text{Text and }\\frac{1}{2}\\text{ is an equation}
, or\\text{Text and $\\frac{1}{2}$ is an equation}
These both render as
$\text{Text and $\frac{1}{2}$ is an equation}$
You can also go into text mode by using a specific font tag. For instance, if you write your text inside the brackets in \\texttt{}
you will get a monospaced typewriter font that looks like $\texttt{this}$.
Besides $\texttt{texttt}$, you can do $\textsf{textsf}$ and $\textbf{textbf}$.
These are the three font tags that will toggle text mode (i.e. spaces show up) and you can also put them inside a \\text{}
tag.
Then there are the math fonts, which you can only use in equation mode (i.e. you can't use them inside \text{} and you have to manually insert spaces with a backslash). These fonts are \\mathfrak{}
, \\mathcal{}
, \\mathscr{}
, and \\mathbb{}
. The last three only work for capital letters. Here's how they look:
$$ \mathfrak{This\ is\ mathfrak.}\\ \mathcal{THIS \ IS\ MATHCAL}\\ \mathscr{THIS \ IS \ MATHSCR}\\ \mathbb{THIS\ IS\ MATHBB} $$
Look at my code and notice I manually added the spaces between words with a \\
. The \\\\
s in the code are just line breaks.