Pandoc 从输入子文件夹加载图像但不加载乳胶文件
Pandoc loading images but not latex files from input subfolder
我有一个 latex 文档,我以 pdf 格式发布,但我需要以 Word .docx 格式与审阅者共享它。我在 figures 子文件夹中的单独 .tex 文件中有一些图像和一堆 tikz 格式的图表。我已经定义了 input@path{{figures/}}
这样我就不必将路径放入每个 \input{blah.tex}
调用中。当我将文档发布为 pdf 时,这工作得很好,但是当我尝试使用 pandoc 创建 docx 时,我收到 .tex 文件的 [WARNING] Could not load include file
错误,尽管图像加载正常。
据我所知,pandoc 应该能够从子文件夹加载文件并且 input@path 应该设置它 (this post discuses how to use pandoc parameters to define the input@path)。
我确定这是我的一些基本理解不足,但这里有一个最基本的非工作示例:
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}
和 exTikz.tex(从 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}
我也试过--resource-path=figures
没用。
我意识到,为了使用 .docx 中的图表,我需要使用 lua-过滤器将 tikz 转换为 png ala this post,但首先我在应用过滤器之前,需要 pandoc 实际访问卡在各种 .tex 文件中的 \begin{tikzpicture}
段。
Pandoc 不支持 \input@path
参数。您可以打开功能请求 here.
我建议使用 TeX 将 TikZ 包编译成适当的图形,例如使用in this Q&A描述的方法,然后使用\renewcommand
将\input
更改为\includegraphics
,pandoc会理解。这也将允许使用 --resource-path
选项。
我有一个 latex 文档,我以 pdf 格式发布,但我需要以 Word .docx 格式与审阅者共享它。我在 figures 子文件夹中的单独 .tex 文件中有一些图像和一堆 tikz 格式的图表。我已经定义了 input@path{{figures/}}
这样我就不必将路径放入每个 \input{blah.tex}
调用中。当我将文档发布为 pdf 时,这工作得很好,但是当我尝试使用 pandoc 创建 docx 时,我收到 .tex 文件的 [WARNING] Could not load include file
错误,尽管图像加载正常。
据我所知,pandoc 应该能够从子文件夹加载文件并且 input@path 应该设置它 (this post discuses how to use pandoc parameters to define the input@path)。
我确定这是我的一些基本理解不足,但这里有一个最基本的非工作示例:
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}
和 exTikz.tex(从 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}
我也试过--resource-path=figures
没用。
我意识到,为了使用 .docx 中的图表,我需要使用 lua-过滤器将 tikz 转换为 png ala this post,但首先我在应用过滤器之前,需要 pandoc 实际访问卡在各种 .tex 文件中的 \begin{tikzpicture}
段。
Pandoc 不支持 \input@path
参数。您可以打开功能请求 here.
我建议使用 TeX 将 TikZ 包编译成适当的图形,例如使用in this Q&A描述的方法,然后使用\renewcommand
将\input
更改为\includegraphics
,pandoc会理解。这也将允许使用 --resource-path
选项。