Hi everyone,

On an org-mode document, I would like to use the LaTeX package named
Circuitikz to draw electronic circuits. I choose to write it as LaTeX
fragments in my org-mode document.

The PDF export work perfectly, but not the fragment preview or the HTML
export.

I tried to search a solution that could apply to LaTeX fragments, but
with no success. I could switch to Org-babel, but before I would like to
know if it's possible to do it with fragments.

Thank you very much for your help.


* The org-mode document

Here is a copy of the document I use for testing:

    #+TITLE:         Tests with Circuitkz
    #+LATEX_HEADER:  \usepackage{circuitikz}
    
    Here is a simple component draw with Circuitkz:
    
    \begin{circuitikz}
    \draw (0,0) to [R,v=$U_1$] (2,0);
    \end{circuitikz}


* The preview

If I call interactively the Emacs function `org-latex-preview', the
preview does not show a circuit. Instead, I have a kind of equation with
only U_1 inside it.

* The HTML export

If I export using the built-in Org HTML exporter, with MathJax, I get an
error on the web page when it is rendered by a browser. The error is:
"Unknown environment 'circuitikz'". I think it's MathJax who don't know
what to do with this environment. But after searching, I could not found
a way to add Circuitkz support in MathJax.

I also tried to use ImageMagick and dvipng to export to HTML. By adding
"#+OPTIONS: tex:imagemagick" in my org-mode document. But in the
rendered HTML document, I got an equation that contain what is written
inside the "circuitkz" environment below.


* Versions used

I tested with Emacs launched with the command `emacs -Q'.

Emacs version: 30.2
Org-mode version: 9.7.11
Circuitkz version: svn77600, installed on Fedora via dnf package manager


Reply via email to