From 25ad4f7d419b5d2798645a565138c97c65c0eab6 Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Tue, 4 Mar 2025 17:58:59 -0300 Subject: [PATCH] mention typewriter font in LaTeX guide --- docs/guides/guide-for-latex-users.md | 42 ++++++++++++++++++---------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/docs/guides/guide-for-latex-users.md b/docs/guides/guide-for-latex-users.md index fffa6c521..4e2f5e9a4 100644 --- a/docs/guides/guide-for-latex-users.md +++ b/docs/guides/guide-for-latex-users.md @@ -75,21 +75,23 @@ Emphasis (usually rendered as italic text) is expressed by enclosing text in Here is a list of common markup commands used in LaTeX and their Typst equivalents. You can also check out the [full syntax cheat sheet]($syntax). -| Element | LaTeX | Typst | See | -|:-----------------|:--------------------------|:-----------------------|:-----------| -| Strong emphasis | `\textbf{strong}` | `[*strong*]` | [`strong`] | -| Emphasis | `\emph{emphasis}` | `[_emphasis_]` | [`emph`] | -| Monospace / code | `\texttt{print(1)}` | ``[`print(1)`]`` | [`raw`] | -| Link | `\url{https://typst.app}` | `[https://typst.app/]` | [`link`] | -| Label | `\label{intro}` | `[]` | [`label`] | -| Reference | `\ref{intro}` | `[@intro]` | [`ref`] | -| Citation | `\cite{humphrey97}` | `[@humphrey97]` | [`cite`] | -| Bullet list | `itemize` environment | `[- List]` | [`list`] | -| Numbered list | `enumerate` environment | `[+ List]` | [`enum`] | -| Term list | `description` environment | `[/ Term: List]` | [`terms`] | -| Figure | `figure` environment | `figure` function | [`figure`] | -| Table | `table` environment | `table` function | [`table`] | -| Equation | `$x$`, `align` / `equation` environments | `[$x$]`, `[$ x = y $]` | [`equation`]($math.equation) | +| Element | LaTeX | Typst | See | +|:-----------------------|:--------------------------|:-----------------------|:-----------| +| Strong emphasis | `\textbf{strong}` | `[*strong*]` | [`strong`] | +| Emphasis | `\emph{emphasis}` | `[_emphasis_]` | [`emph`] | +| Link | `\url{https://typst.app}` | `[https://typst.app/]` | [`link`] | +| Label | `\label{intro}` | `[]` | [`label`] | +| Reference | `\ref{intro}` | `[@intro]` | [`ref`] | +| Citation | `\cite{humphrey97}` | `[@humphrey97]` | [`cite`] | +| Verbatim / code | `\verb|print(f"{x}")|`, `verbatim` / `listing` environments | ``[`print(f"{x}")`]`` | [`raw`] | +| Monospace / typewriter | `\texttt{mono}` | ``[`mono`]`` or `text` function | [`raw`], [`text`] | +| Verbatim | `verbatim` environment | ``[`#typst-code()`]`` | [`raw`] | +| Bullet list | `itemize` environment | `[- List]` | [`list`] | +| Numbered list | `enumerate` environment | `[+ List]` | [`enum`] | +| Term list | `description` environment | `[/ Term: List]` | [`terms`] | +| Figure | `figure` environment | `figure` function | [`figure`] | +| Table | `table` environment | `table` function | [`table`] | +| Equation | `$x$`, `align` / `equation` environments | `[$x$]`, `[$ x = y $]` | [`equation`]($math.equation) | [Lists]($list) do not rely on environments in Typst. Instead, they have lightweight syntax like headings. To create an unordered list (`itemize`), @@ -121,6 +123,16 @@ To get a [numbered list]($enum) (`enumerate`) instead, use a `+` instead of the hyphen. For a [term list]($terms) (`description`), write `[/ Term: Description]` instead. +Regarding the usage of monospace fonts (also known as "typewriter" font style +in LaTeX), it should be noted that using [`raw`] such as in +``[`monospace`]`` (where you'd use `\texttt{monospace}` in LaTeX) works for +most cases where you only have simple text. If you need to use formatting, such +as in `\texttt{monospace \textbf{bold}}`, you will need to replicate its look by +switch to changing the text font to a monospace font with +`#text(font: "DejaVu Sans Mono", size: 0.8em)[monospace *bold*]`, for example, +since `raw` only supports verbatim (unformatted) text. See its documentation +for more details. + ## How do I use a command? { #commands } LaTeX heavily relies on commands (prefixed by backslashes). It uses these _macros_ to affect the typesetting process and to insert and manipulate content.