Reputation: 45
I've got a latex document that I publish as a pdf, but I need to share it with reviewers in Word .docx format. I've got some images and a bunch of graphs in tikz format in a separate .tex files in a figures subfolder. I've defined input@path{{figures/}}
so that I don't have to put the path into each \input{blah.tex}
call. This works just fine when I publish the document as a pdf, but when I try to use pandoc to create the docx I get a [WARNING] Could not load include file
error for the .tex files, though the images load fine.
As far as I can tell, pandoc should be able to load files from subfolders and the input@path should set it up (this post discuses how to use pandoc parameters to define the input@path).
I'm sure this is some basic lack of understanding on my part, but here's a minimum non-working example:
example.tex:
\documentclass[11pt,twoside,letterpaper]{article}
\makeatletter
\def\input@path{{figures/}}
\makeatother
\begin{document}
\begin{figure}[H]
\centering
\caption{Tikz Example}
\input{exTikz.tex}
\label{fig:exTikz}
\end{figure}
\end{document}
And the exTikz.tex (lifted from https://latex-tutorial.com/tutorials/tikz/)
\begin{tikzpicture}
\draw [red,dashed] (-2.5,2.5) rectangle (-1.5,1.5) node [black,below] {Start}; % Draws a rectangle
\draw [thick] (-2,2) % Draws a line
to [out=10,in=190] (2,2)
to [out=10,in=90] (6,0)
to [out=-90,in=30] (-2,-2);
\draw [fill] (5,0.1) rectangle (7,-0.1) node [black,right] {Obstacle}; % Draws another rectangle
\draw [red,fill] (-2,-2) circle [radius=0.2] node [black,below=4] {Point of interest}; % Draws a circle
\end{tikzpicture}
I have also tried --resource-path=figures
to no avail.
I realize that in order to use the graphs in a .docx I'm going to need to use a lua-filter to convert the tikz's to png ala this post, but first I need to pandoc to actually access the \begin{tikzpicture}
segments stuck in the various .tex files before it will apply the filter.
Upvotes: 1
Views: 589
Reputation: 22544
Pandoc does not support the \input@path
parameter. You could open a feature request here.
I suggest to use TeX to compile the TikZ packages into proper graphics, e.g. with the method described in this Q&A, then use \renewcommand
to change \input
to \includegraphics
, which pandoc will understand. This will also allow to make use of the --resource-path
option.
Upvotes: 3