Skip to content

How to enable Typst rendering of math #11368

Answered by cderv
sverrirarnors asked this question in Q&A
Discussion options

You must be logged in to vote

Yes this is how Math work in Pandoc. More at https://pandoc.org/MANUAL.html#math

If you want to write raw typst, then you need raw block as you already do.

You could also catched the math in a lua filter, and do output it as a raw block directly.

-- Inline Math
Math = function(m)
  if not quarto.doc.is_format('typst') then
    return nil
  end
  if m.mathtype == "InlineMath" then
    return pandoc.RawInline('typst', '$'.. m.text .. '$')
  end
end

-- DisplayMath
-- We want to replace all Para by a RawBlock
Para = function(p)
  if not quarto.doc.is_format('typst') then
    return nil
  end
  if p.content[1].t == "Math" and p.content[1].mathtype == "DisplayMath" then
    return pandoc.RawBlock

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@mcanouil
Comment options

@cderv
Comment options

Answer selected by sverrirarnors
@sverrirarnors
Comment options

@arnaudgallou
Comment options

@cderv
Comment options

@sverrirarnors
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
typst lua Issues related to the lua codebase, filter chain, etc math any issue related to math support in specific formats
4 participants