迷你页面的格式很奇怪

迷你页面的格式很奇怪

我有 3 个想要排列的图形。在迷你 tikz 页面中,图形 a 将位于图形 b 之上,而图形 c 将位于图形 a 和 b 旁边。下面的代码给出了一种奇怪的格式。

\documentclass[twocolumn]{book}
\usepackage   {lipsum}
\usepackage   {showframe} % just for this example
\usepackage   {subfig}
\usepackage   {tikz}

\begin{document}
\lipsum[1]

\begin{figure}
\centering
\begin{minipage}{0.2\textwidth}
\centering
\begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.6\textwidth,trim={0 0 0 0},clip]{example-image}};
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
          \foreach \i/\j in {{(0.2,0.6)/(0.2,1.1)},{(0.3,0.75)/(0.3,1.1)},{(0.39,1)/(0.39,1.1)},{(0.62,0.7)/(0.62,1.1)}} \draw [-stealth, red, thick] \i -- \j;
          \node[scale=0.5] at (0.42,1.15) {$\{O^{(1)},O^{(2)},O^{(3)}, \ ... \ , O^{(7)}\}$};
          \node[scale=0.5] at (0.42,1.25) {$O^{(n)}$ for Pick Action};
    \end{scope}
\end{tikzpicture}
\subfloat[]{\begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.6\textwidth,trim={0 0 0 0},clip]{example-image}};
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
          \foreach \i/\j in {{(0.015,0.68)/(0.015,1.1)},{(0.15,0.7)/(0.15,1.1)},{(0.285,0.72)/(0.285,1.1)},{(0.42,0.74)/(0.42,1.1)},{(0.557,0.77)/(0.557,1.1)}} \draw [-stealth, red, thick] \i -- \j;
          \node[scale=0.5] at (0.33,1.15) {$\{O^{(1)},\ O^{(2)},\ O^{(3)},\ O^{(4)}, \ O^{(5)}, \ ... \}$};
          \node[scale=0.5] at (0.35,1.25) {$O^{(n)}$ for Place Action};
    \end{scope}
\end{tikzpicture}}{}
\end{minipage}\hfill
\begin{minipage}{0.28\textwidth}
\centering
\subfloat[]{}\includegraphics[width=1\textwidth,trim={0 0 0 0},clip]{example-image}
\end{minipage}
\end{figure}

\lipsum[2]
\end{document}

2 张较小的图片没有对齐。标题 a 和 b 没有居中。所有 3 张图片的顶部和底部都没有对齐。我做错了什么?

在此处输入图片描述

答案1

你失踪了\subfloat

我会使用tabular左边的两张图片。

\documentclass[twocolumn]{book}
\usepackage   {lipsum}
\usepackage   {showframe} % just for this example
\usepackage   {subfig}
\usepackage   {tikz}

\begin{document}

\lipsum[1]

\begin{figure}[htp]
\centering

\begin{tabular}[b]{@{} c @{}}
\subfloat[]{\begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.25\columnwidth,trim={0 0 0 0},clip]{example-image}};
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
          \foreach \i/\j in {{(0.2,0.6)/(0.2,1.1)},{(0.3,0.75)/(0.3,1.1)},{(0.39,1)/(0.39,1.1)},{(0.62,0.7)/(0.62,1.1)}} \draw [-stealth, red, thick] \i -- \j;
          \node[scale=0.5] at (0.42,1.15) {$\{O^{(1)},O^{(2)},O^{(3)}, \ ... \ , O^{(7)}\}$};
          \node[scale=0.5] at (0.42,1.3) {$O^{(n)}$ for Pick Action};
    \end{scope}
\end{tikzpicture}} \\
\subfloat[]{\begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.25\columnwidth,trim={0 0 0 0},clip]{example-image}};
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
          \foreach \i/\j in {{(0.015,0.68)/(0.015,1.1)},{(0.15,0.7)/(0.15,1.1)},{(0.285,0.72)/(0.285,1.1)},{(0.42,0.74)/(0.42,1.1)},{(0.557,0.77)/(0.557,1.1)}} \draw [-stealth, red, thick] \i -- \j;
          \node[scale=0.5] at (0.33,1.15) {$\{O^{(1)},\ O^{(2)},\ O^{(3)},\ O^{(4)}, \ O^{(5)}, \ ... \}$};
          \node[scale=0.5] at (0.35,1.3) {$O^{(n)}$ for Place Action};
    \end{scope}
\end{tikzpicture}}
\end{tabular}\hfill
\subfloat[]{\includegraphics[width=0.6\columnwidth,trim={0 0 0 0},clip]{example-image}}
\end{figure}

\lipsum[2]
\end{document}

在此处输入图片描述

相关内容