Are there equivalent to the LaTeX microtype package and the memoir document class?

Are there plans to create a microtype type package for typst? How does the current state of typst’s typography compare to LaTeX + microtype?

Is there a memoir class available for typst?

1 Like

Hello and welcome @untouched_coliseum!

Looking at microtype’s features, it seems it is already available in Typst in most parts:

I don’t think control is as precise as it is in microtype, but most usecases should be satisfied with this amount of customization. I’m not even sure a package would be the right tool to modify typography at this level… In any case, don’t hesitate to go through each argument in text, it’s pretty long, but also pretty exhaustive.

As for the memoir template, I can’t say I have seen a typst template named “memoir”, but there are plenty of thesis templates.
You can look at officially affiliated templates for example here.

3 Likes

Hello @untouched_coliseum, I have changed your post title to
“Are there equivalent to the LaTeX microtype package and the memoir document class?”, tell me if you think that’s incorrect!

1 Like

@quachpas, you showed that Typst has all the primitives to do what is required but what expansion and tracking are about in the context of microtype performing tiny per-paragraph alterations that are hardly noticeable by eye but makes spacing more even overall.

Edit: I was wrong about tracking.

1 Like

You’re quite right. The stretch parameter in Typst is completely manual unlike microtype’s feature expansion, where like you said the package does automatic expansion (pdfTeX>1.20).
I don’t think it would be possible to implement that kind of customization within Typst itself (I might be wrong, some people are creating crazy packages everyday…)

1 Like

I saw the following PR which implements some more exciting microtype features Add microtypography in paragraph justification by diquah · Pull Request #6161 · typst/typst · GitHub

1 Like

I see this PR was merged. Could you share the documentation or a brief implementation example?

I attempted the following in the Typst web editor:

#set par(justify: true, microtype: (max-expand: 0.02em, max-retract: 0.015em))

However, I encountered this error:

Error: Unexpected argument: microtype

Am I missing something?
Thanks!

I can’t find exactly when the properties were what you used in your example, but the merged PR contained changes to this: https://typst.app/docs/reference/model/par/#parameters-justification-limits

2 Likes

This is a configuration that you can try:

#set par(justify: true, justification-limits: (tracking: (max: 0.02em, min: -0.015em)))

For future reference, this works from Typst 0.14.

1 Like

It’s from the experiments in the comment section:

Looks like what I missed is the patience to scroll down to the actual final implementation that got merged!

Also thanks @bluss for the example!