我想生成一个图形并将其作为 PDF 嵌入到另一个文档中。为此,我想使用standalone
我以前用过的类。但现在我遇到了很大的麻烦。
以下 MWE 按预期工作。
\documentclass{article}
\usepackage{subfig}
\usepackage[demo]{graphicx}
\newcommand{\imsize}{0.33\linewidth}
\begin{document}
\begin{figure}[htb]
\centering
\subfloat[][Here is some text.]{\includegraphics[width=\imsize]{<figure1>}}
\subfloat[][Here is some more text.]{\includegraphics[width=\imsize]{<figure1>}}
\subfloat[][Here is even more text, which should then break on several lines.]{\includegraphics[width=\imsize]{<figure1>}}
\end{figure}
\end{document}
但是当我使用该类standalone
来获取最小图形 PDF 时,编译失败,而且我似乎找不到罪魁祸首,例如,我在 Ubuntu 16.04 上! LaTeX Error: Something's wrong--perhaps a missing \item.
使用版本 4.45 编译下面的代码时遇到的问题。latexmk
\documentclass{standalone}
\usepackage{subfig}
\usepackage[demo]{graphicx}
\newcommand{\imsize}{0.33\linewidth}
\begin{document}
\begin{figure}
\centering
\subfloat[][Here is some text.]{\includegraphics[width=\imsize]{<figure1>}}
\subfloat[][Here is some more text.]{\includegraphics[width=\imsize]{<figure1>}}
\subfloat[][Here is even more text, which should then break on several lines.]{\includegraphics[width=\imsize]{<figure1>}}
\end{figure}
\end{document}
答案1
添加preview
选项:
\documentclass[preview, border=5pt]{standalone}
\usepackage{geometry}
\usepackage{subfig}
\usepackage{graphicx}
\newcommand{\imsize}{0.32\linewidth}
\begin{document}
\begin{figure}
\centering
\subfloat[][Here is some text.]{\includegraphics[width=\imsize]{TheLarch}}\enspace
\subfloat[][Here is some more text.]{\includegraphics[width=\imsize]{TheLarch}}\enspace
\subfloat[][Here is even more text, which should then break on several lines.]{\includegraphics[width=\imsize]{TheLarch}}
\end{figure}
\end{document}