并排插入多个 TikZ 图像

并排插入多个 TikZ 图像

我正在使用以下代码借用自这里经过一些修改:

\documentclass[10pt]{article}

\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{figure}

\begin{minipage}[b][5cm][s]{.45\linewidth}
\begin{tikzpicture}[
  pool/.style={
    circle, draw=blue!50, fill=blue!20, thick,
    inner sep=0pt, minimum size=10mm
  }
]
  \node[pool] (A)              {A};
  \node[pool] (B) [right=of A] {B};
  \draw [<->] (A) -- (B);
\end{tikzpicture}

\vspace*{1cm}

\begin{tikzpicture}[
  pool/.style={
    circle, draw=blue!50, fill=blue!20, thick,
    inner sep=0pt, minimum size=10mm
  }
]
  \node[pool] (A)              {A};
  \node[pool] (B) [right=of A] {B};
  \draw [<->] (A) -- (B);
\end{tikzpicture}

\vspace*{1cm}

\begin{tikzpicture}[
  pool/.style={
    circle, draw=blue!50, fill=blue!20, thick,
    inner sep=0pt, minimum size=10mm
  }
]
  \node[pool] (A)              {A};
  \node[pool] (B) [right=of A] {B};
  \draw [<->] (A) -- (B);
\end{tikzpicture}

\vspace*{1cm}

\begin{tikzpicture}[
  pool/.style={
    circle, draw=blue!50, fill=blue!20, thick,
    inner sep=0pt, minimum size=10mm
  }
]
  \node[pool] (A)              {A};
  \node[pool] (B) [right=of A] {B};
  \draw [<->] (A) -- (B);
\end{tikzpicture}
\end{minipage}
\begin{minipage}[b][5cm][s]{.45\linewidth}

\begin{tikzpicture}[
  pool/.style={
    circle, draw=blue!50, fill=blue!20, thick,
    inner sep=0pt, minimum size=10mm
  }
]
  \node[pool] (A)              {A};
  \node[pool] (B) [right=of A] {B};
  \draw [<->] (A) -- (B);
\end{tikzpicture}

\vspace*{1cm}

\begin{tikzpicture}[
  pool/.style={
    circle, draw=blue!50, fill=blue!20, thick,
    inner sep=0pt, minimum size=10mm
  }
]
  \node[pool] (A)              {A};
  \node[pool] (B) [right=of A] {B};
  \draw [<->] (A) -- (B);
\end{tikzpicture}

\vspace*{1cm}

\begin{tikzpicture}[
  pool/.style={
    circle, draw=blue!50, fill=blue!20, thick,
    inner sep=0pt, minimum size=10mm
  }
]
  \node[pool] (A)              {A};
  \node[pool] (B) [right=of A] {B};
  \draw [<->] (A) -- (B);
\end{tikzpicture}

\vspace*{1cm}

\begin{tikzpicture}[
  pool/.style={
    circle, draw=blue!50, fill=blue!20, thick,
    inner sep=0pt, minimum size=10mm
  }
]
  \node[pool] (A)              {A};
  \node[pool] (B) [right=of A] {B};
  \draw [<->] (A) -- (B);
\end{tikzpicture}
\end{minipage}

\caption{Numerous images.}

\end{figure}

\end{document}

\caption如下图所示,插入不正确:

在此处输入图片描述

如何解决这个问题?

答案1

s的第二个参数minipageie5cm指定了这些框的高度,但高度不会延伸,因此当您的图表的高度大于 5 厘米时,它们会延伸到框外面,并且您会在日志中收到几个“过满 vbox”警告。

如果将该参数留空,则框将具有框中内容的高度:

\begin{minipage}[b][][s]{.45\linewidth}

顺便问一下,s这里要做什么?我不认为这是有效的选项之一,但也许我错了。

相关内容