4

I want to be able to use the commands in the circuitikz package for drawing circuit diagrams in my document which I am writing in Pandoc Markdown. I am familiar with inlining Latex math mode commands in pandoc but would it be possible to use the circuitikz environment and its associated commands as well ?

Edit: I am interested in PDF output only.

1
  • Are you interested in only PDF output from Pandoc, or conversion to other formats as well?
    – Alan Munn
    Commented Mar 8, 2021 at 1:18

1 Answer 1

4

If you're only interested in PDF output from Pandoc, then you can just load the ciruitikz package in the header-includes: portion of your Markdown document as in the example below. If you want to do conversions to other formats, things are more complicated, but there are some questions on the site on how to include TikZ images into converted Pandoc documents. See e.g.

--- 
header-includes: |
    \usepackage{circuitikz}
---
# A heading

Some text.


\begin{circuitikz}[american]
\draw (0,0) to[isource, l=$I_0$] (0,3) --
        (2,3)
   to[R=$R_1$] (2,0) -- (0,0);
   \draw (2,3) -- (4,3) to[R=$R_2$]
(4,0) -- (2,0); \end{circuitikz}

output of code

2
  • sorry for the delayed response. Thanks a lot! this actually clarified a lot of things for me. I guess the question that I should have asked was : "How to use an arbitrary package within pandoc".
    – First User
    Commented Mar 9, 2021 at 17:15
  • One thing you might want to be aware of is that with complex inline TeX, pandoc can sometimes get confused, and it might be better to use the raw_attribute extension rather than using the TeX inline like I've done here. See github.com/jgm/pandoc/issues/4646 and pandoc.org/MANUAL.html#extension-raw_attribute. I'd try it until it breaks. :)
    – Alan Munn
    Commented Mar 9, 2021 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .