我正在使用出色的标记包来编译我的文档,其中包含不同质量和/或文件格式的图形。MWE
\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{tagging}
\usetag{jpg}
\begin{document}
\begin{figure}[!htbp]
\begin{subfigure}[b]{0.50\textwidth}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.35\textwidth}
\tagged{png}{\includegraphics[width=\textwidth]{example-image-b.png}}
\tagged{jpg}{\includegraphics[width=\textwidth]{example-image-b.jpg}}
\tagged{pdf}{\includegraphics[width=\textwidth]{example-image-b.pdf}}
\end{subfigure}
\end{figure}
\begin{figure}[!htbp]
\begin{subfigure}[b]{0.50\textwidth}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.35\textwidth}
\tagged{jpg}{\includegraphics[width=\textwidth]{example-image-b.jpg}}
\end{subfigure}
\end{figure}
\begin{figure}[!htbp]
\begin{subfigure}[b]{0.50\textwidth}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.35\textwidth}
% just a comment
\tagged{jpg}{\includegraphics[width=\textwidth]{example-image-b.jpg}}
% just a comment
\end{subfigure}
\end{figure}
\end{document}
将产生:
如您所见,第一个图的子图相互垂直对齐不知何故被破坏了。似乎在输出流中留下了一些东西,导致两个子图之间错位。只包含其中一个\tagged{png}{...}
命令(第二种情况)或在正在使用的命令上方和下方注释一行(第三种情况)将导致左/右图的底部边缘完美对齐。任何关于如何进一步诊断问题或修复它的建议都非常感谢!\tagged{pdf}{...}
\tagged
\tagged
答案1
tagging
这和你从哪里得到同样的东西没有关系
\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[!htbp]
\begin{subfigure}[b]{0.50\textwidth}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.35\textwidth}
{}
\includegraphics[width=\textwidth]{example-image-b.jpg}
{}
\end{subfigure}
\end{figure}
\begin{figure}[!htbp]
\begin{subfigure}[b]{0.50\textwidth}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.35\textwidth}
\includegraphics[width=\textwidth]{example-image-b.jpg}
\end{subfigure}
\end{figure}
\begin{figure}[!htbp]
\begin{subfigure}[b]{0.50\textwidth}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.35\textwidth}
% just a comment
\includegraphics[width=\textwidth]{example-image-b.jpg}
% just a comment
\end{subfigure}
\end{figure}
\end{document}
标签省略的图形相当于{}
因此不产生输出,但您没有省略两边的单词空格。
你最终会得到一行只有一个单词空格的行,这会产生警告
Underfull \hbox (badness 10000) in paragraph at lines 14--16
注释掉空格会删除 Tex 警告并修复对齐问题
\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[!htbp]
\begin{subfigure}[b]{0.50\textwidth}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.35\textwidth}
{}%
\includegraphics[width=\textwidth]{example-image-b.jpg}%
{}%
\end{subfigure}
\end{figure}
\begin{figure}[!htbp]
\begin{subfigure}[b]{0.50\textwidth}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.35\textwidth}
\includegraphics[width=\textwidth]{example-image-b.jpg}
\end{subfigure}
\end{figure}
\begin{figure}[!htbp]
\begin{subfigure}[b]{0.50\textwidth}
\includegraphics[width=3cm]{example-image-a.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.35\textwidth}
% just a comment
\includegraphics[width=\textwidth]{example-image-b.jpg}
% just a comment
\end{subfigure}
\end{figure}
\end{document}