Replies: 3 comments 1 reply
-
|
I would say to write a Lua filter that:
Something like: local function math_to_image(math_node)
if math_node.mathtype ~= 'DisplayMath' then
return math_node
end
local tex_content = math_node.text
if not tex_content or tex_content == '' then
return math_node
end
-- Generate a unique filename based on the equation content
local hash = pandoc.sha256(tex_content)
local image_path = 'math-images/' .. hash .. '.png'
-- TODO: Implement actual equation rendering
-- For now, return an Image node pointing to the generated path
return pandoc.Image(
{ pandoc.Str('LaTeX Equation') },
image_path,
'fig:equation',
{
['data-equation'] = tex_content,
class = 'math-equation-image'
}
)
end
return {
{
Math = math_to_image
}
} |
Beta Was this translation helpful? Give feedback.
-
|
I though he easiest way would be to leverage the (webtex being a service that takes a TeX equation and returns an image. Example of deployed service: https://latex.codecogs.com/) Other ways to not go through Lua are to leverage the computation engine also. For example, in knitr ecosystem there is:
This is the same idea as with Lua filter but using R code. Probably there is equivalent in Python ecosystem.
Essentially, you need to devise your own solution for the conversion. If you go Lua filter road, it can become a Quarto extension, independant of engine. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you both! I'll investigate the strategies you have proposed Cheers! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
What is the best/easiest way to generate all equations within a Quarto document as images when rendering in Word (docx) format? We want to avoid them being formatted as Microsoft equations, just want plain images.
I found this old thread (https://forum.posit.co/t/rendering-equations-as-images-for-microsoft-output/13862/6) and wondered if there are new ways to do so nowadays. Is there a Quarto option to render all equations as images? Maybe an R package?
Thank you very much in advance
Beta Was this translation helpful? Give feedback.
All reactions