![使用带有 subfig 的“独立”类时遇到问题](https://linux22.com/image/377405/%E4%BD%BF%E7%94%A8%E5%B8%A6%E6%9C%89%20subfig%20%E7%9A%84%E2%80%9C%E7%8B%AC%E7%AB%8B%E2%80%9D%E7%B1%BB%E6%97%B6%E9%81%87%E5%88%B0%E9%97%AE%E9%A2%98.png)
我想生成一个图形并将其作为 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}