我在对齐多个图形时遇到了一些麻烦。 png 图形和 tikz 图形都存在这个问题,所以我猜我遗漏了一些东西。
tikz 图形未正确对齐:
特定代码:
\begin{figure}
\centering
\input{figs/grf_left_fb.tikz}
\input{figs/grf_fb.tikz}
\input{figs/phase_fb.tikz}
\input{figs/zap_fb.tikz}
\caption{......}
\label{fig:feedback}
\end{figure}
并带有 png 图形(需要垂直和水平对齐):
\begin{figure}
\centering
\includegraphics[scale=0.25]{figs/s1.eps}
\includegraphics[scale=0.25]{figs/s2.eps}
\includegraphics[scale=0.25]{figs/s3.eps}
\includegraphics[scale=0.25]{figs/s11.eps}
\includegraphics[scale=0.25]{figs/s28.eps}
\caption{S..........}
\label{fig:data_good_bad}
\end{figure}
答案1
您的图片完全按照您的要求对齐:位于文本宽度的中心。我猜想您希望它们的右边框也对齐。您可以通过将每张图片放置在minipage
(或等效位置parabox
)右对齐的位置,然后将所有小页面放置在中心来实现这一点。
编辑: 我用 MWE 替换我的例子,其中包含对齐问题第一部分和对齐问题第二部分的解决方案
\documentclass{article}
\usepackage{tikz,graphicx,lipsum}
\begin{document}
\lipsum[7]
\begin{figure}[h]\centering
\begin{minipage}{77mm}\raggedleft
\tikz\node[draw,
minimum width=55mm, minimum height=11mm] {picture 1};
\end{minipage}\medskip
\begin{minipage}{77mm}\raggedleft
\tikz\node[draw,label=left:label,
minimum width=55mm, minimum height=11mm] {picture 2};
\end{minipage}
\caption{very important figures ...}
\label{fig:data ...}
\end{figure}
\lipsum[7]
\begin{figure}[h]\centering
\begin{minipage}[b][22mm][t]{55mm}
\tikz\node[draw,
minimum width=44mm, minimum height=11mm] {picture 3};
\end{minipage}
\hfil
\begin{minipage}[b][22mm][t]{55mm}
\tikz\node[draw,label=below:label,
minimum width=44mm, minimum height=11mm] {picture 4};
\end{minipage}
\caption{another very important figures ...}
\label{fig:data ...}
\end{figure}
\end{document}
环境minipage
实际上有三个参数。
\begin{minpage}[<position>][height][inner position]{<width>}
text: your image
\end{minipage}
使用类似的语法将得到等效结果\parbox
:
\parbox[<position>][height][inner position]{<width>}{ text: your image }
答案2
一个可能的解决方案tabulars
\documentclass{article}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage[export]{adjustbox}
\usepackage{mwe}
\begin{document}
\lipsum[1]
\begin{center}
\begin{tabular}{r}
\includegraphics[height=1cm,width=5cm]{example-image-a}\\
\includegraphics[height=1cm,width=5.5cm]{example-image-a}\\
\includegraphics[height=1cm,width=4cm]{example-image-a}\\
\includegraphics[height=1cm,width=5cm]{example-image-a}\\
\end{tabular}
\end{center}
\begin{center}
\begin{tabularx}{\linewidth}{XXX}
\includegraphics[height=1cm,width=3cm]{example-image-a} &
\includegraphics[height=1cm,width=3cm]{example-image-a} &
\includegraphics[height=1cm,width=3cm]{example-image-a}\\
\end{tabularx}
\begin{tabularx}{\linewidth}{>{\raggedleft\arraybackslash}X>{\raggedright\arraybackslash}X}
\includegraphics[height=1cm,width=3cm,valign=t]{example-image-a} &
\includegraphics[height=2cm,width=3cm,valign=t]{example-image-a}\\
\end{tabularx}
\end{center}
\end{document}