summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPgBiel <9021226+PgBiel@users.noreply.github.com>2025-03-04 17:58:59 -0300
committerPgBiel <9021226+PgBiel@users.noreply.github.com>2025-03-04 18:00:47 -0300
commit25ad4f7d419b5d2798645a565138c97c65c0eab6 (patch)
treec96bce780e294542c41cb1faf38252524abdd815
parentc4d7faf5271db65408a68a2da80b965a2de44363 (diff)
mention typewriter font in LaTeX guideimprove-raw-docs
-rw-r--r--docs/guides/guide-for-latex-users.md42
1 files changed, 27 insertions, 15 deletions
diff --git a/docs/guides/guide-for-latex-users.md b/docs/guides/guide-for-latex-users.md
index fffa6c52..4e2f5e9a 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}` | `[<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}` | `[<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.