Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile all latex strings at once #38

Open
greimel opened this issue Jun 13, 2022 · 1 comment
Open

Compile all latex strings at once #38

greimel opened this issue Jun 13, 2022 · 1 comment

Comments

@greimel
Copy link
Contributor

greimel commented Jun 13, 2022

You can compile all latexstrings at once. This produces a multipage pdf.

\documentclass[multi=env]{standalone}
\usepackage{amsmath}
\usepackage{standalone}

\begin{document}

\begin{env}
$x \in X$
\end{env}

\begin{env}
blaaaa
\end{env}

\begin{env}
$X \in XXX$
\end{env}

\end{document}

You can then get the respective page using

function pdf2svg(pdf::Vector{UInt8}; page=1, kwargs...)
     pdftocairo = Poppler_jll.pdftocairo() do exe
         open(`$exe -f $page -l $page -svg - -`, "r+")
     end

     write(pdftocairo, pdf)

     close(pdftocairo.in)

     return read(pdftocairo.out, String)
 end

This should speed up compilation at lot.

@asinghvi17
Copy link
Member

I do that already for vectors of latexstrings :) but because of the eager nature of the rendering, it's not so easy to batch them. For example, axis tick labels are batched such that all x tick labels are compiled in the same document, and all y tick labels are compiled in a different document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants