Confused about "horizontal" (slash) fractions

If I understand correctly, the code $1/2$ produces a “vertical” fraction and to get a “horizontal” (slash) fraction you use $frac(1, 2, style:"horizontal")$ according to this page Fraction Function – Typst Documentation . I thought that this is the answer to the question “How to get a horizontal fraction?”

But, searching this forum, I’ve found a few packages whose purposes seem to be, or include, to print horizontal fractions. How do you choose one method over another?

A related question is, is it possible to automatically default to the horizontal style when the math appears inline and to the vertical style in the displayed math? I use a lot of inline fractions and it’s sort of depressing that I have to write frac(x, 2, style: "horizontal") each time I want “x/2”.

You are correct, the liked documentation is the answer :smile:, but the feature was only introduced in the latest version of Typst (v0.14.0) which was released in October.

You can do that with the following show rule:

#show math.equation.where(block: false): set math.frac(style: "horizontal")

$1/2$ 
$ 1/2 $ 

test(1)

3 Likes

In that regard, are there de facto standard article classes (packages?)?

In LaTeX, the article class is that. You have several options to it. So, for example, you give the fleqn option to the class for flush-left alignment of math throughout the document.

In typst, I see myself listing 5–10 cutomizations at the top of each of my documents. If I give my typst document to somebody else, s/he may be surprised that the output from my document differs from what s/he expects until s/he examines the ~30 lines of my code near the top of the document.

. . . so, it would be nice if there are standard “styles” with a lot of customization options.

Maybe typst is still too young and perhaps we will eventually have such a system.

You have to agree on the output and set up the preamble in this was to avoid surprises. Any number of styling lines can be moved to a separate settings/template file.

There are no standard styles, unless it’s from a journal/university/etc. See Search — Typst: Universe.

Can’t tell if it’s de facto, but probably the only one that exists: rubber-article – Typst Universe.