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

Generate figures for .tex output #33

Open
simlei opened this issue May 15, 2019 · 3 comments
Open

Generate figures for .tex output #33

simlei opened this issue May 15, 2019 · 3 comments

Comments

@simlei
Copy link

simlei commented May 15, 2019

Hi,
the filter works great - for .pdf or .html output. When using .tex as output, the figure does not get generated, though. I have a pipeline that cannot let pandoc do all the work, but rely on pandoc to output .tex and finalize with a normal xetex/latexmk step.

I guess it would involve to keep the generated graph image around and pandoc would generate \figure{... \includegraphics{/path/to/mermaid/graphs/graph1.png} ...} or something like that. currently, I get either no \figure at all, or a \figure with no content, while the same thing works when converting to .pdf.

Could you tell me if that is something this filter could do, and I am just missing a simple thing? If this is not the goal of this filter, to keep generated stuff around after the filter has run -- could you tell me if there is some other approach to make it happen like I described?

@raghur
Copy link
Owner

raghur commented May 16, 2019

I'm not entirely sure I understand - is your source markdown and destination .tex? Could you post a minimal markdown and the command your running to generate the .tex?

@TheAlgorythm
Copy link

I've created minimal reproducible examples.

% mermaid.tex
\documentclass{article}

\usepackage{listings}

\begin{document}
 
\begin{lstlisting}[language=mermaid]
graph LR
   A(LaTeX-Datei) -->|pandoc| B(LaTeX-Datei)
   B -->|pdflatex| C(PDF-Datei)
\end{lstlisting}

\end{document}
<!-- mermaid.md -->
```mermaid
graph LR
   A(Markdown-Datei) -->|pandoc| B(PDF-Datei)
```
pandoc -f latex -t latex -F mermaid-filter mermaid.tex -o graph.tex
pandoc -t latex -F mermaid-filter mermaid.md -o graph_md.tex

But both outputs are empty.

But the conversion to pdf works.

pandoc -f latex -t pdf -F mermaid-filter mermaid.tex -o graph.pdf
pandoc -t pdf -F mermaid-filter mermaid.md -o graph_md.pdf

@alxmz2
Copy link

alxmz2 commented Mar 3, 2023

Hello. Thanks for such a wonderful filter. I am using it with Obsidian and it works great with at least odt html and epub exports. However, it does not produce any figure at all when exporting to LaTeX.

The note has this content

~~~mermaid
graph LR
    A[Square Rect] -- Link text --> B((Circle))
    A --> C(Round Rect)
    B --> D{Rhombus}
    C --> D
~~~

and exporting it using pandoc with "--filter mermaid-filter " gives a document with no contents.

I reproduced the same results reported by the minimal example given above by @TheAlgorythm.

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

4 participants