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

Cant get diagram.lua to work with tikz #46

Open
MoritzBeroRoos opened this issue Oct 8, 2024 · 1 comment
Open

Cant get diagram.lua to work with tikz #46

MoritzBeroRoos opened this issue Oct 8, 2024 · 1 comment

Comments

@MoritzBeroRoos
Copy link

MoritzBeroRoos commented Oct 8, 2024

Hi, im sorry but i have to ask if i miss something obvious.
What i have done on a fresh ubuntu system:

  • installed pandoc and verfied that it works
  • install texlive-latex-base and verify that pdflatex works from the command line
  • install inkscape and verify that the inkscape command works from the command line (for me it opens the program)
  • downloaded the file diagram.lua and put it in my home directory along with the following input.tex:

My input.tex

Some math $x^2$.
Here is a circle:
\begin{tikzpicture}
 \draw (0,0) circle (1in);
\end{tikzpicture}
             
Some more  math $\mathbb{R}$.

Now i call pandoc like this

pandoc input.tex -o output.html -f latex -t html --embed-resources --lua-filter=diagram.lua

Expected outcome:
An output.html file containg an svg div.

Actual outcome:
output.html

<p>Some math <span class="math inline"><em>x</em><sup>2</sup></span>.
Here is a circle:</p>
<p>Some more math <span class="math inline"></span>.</p>

There is no image clue to be seen. Also the conversion is extremely fast, which makes me doubt that inkscape has been used.
(if i start inkscape as a gui it takes a few seconds). I get no errors or warnings that i can see.
Also i get the exact same output file if i leave the filter out completely:

pandoc input.tex -o output.html -f latex -t html --embed-resources

Is there something i have to install to use this package?

@tarleb
Copy link
Member

tarleb commented Oct 8, 2024

The filter expects code blocks, so it works best with markdown, rst, org, etc, where it's relatively easy to create such blocks. tikzpictures environments are skipped by the LaTeX reader (or parsed as RawBlock elements with +raw_tex), so one would need a filter to change those elements to something that this filter expects.

See also jgm/pandoc#10270

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