使用 tikz 增加图像之间的空间

使用 tikz 增加图像之间的空间

我的代码如下:

\documentclass{book}
\usepackage{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,fit,shapes,calc}
\usepackage{tikz-cd}
\tcbuselibrary{skins,xparse}

\begin{document}

\def\firstcircle{(1.5,0) circle (0.6cm)}
\def\secondcircle{(1.5,0) circle (1cm)}

\colorlet{circle edge}{black}
\colorlet{circle area}{gray!20}

\tikzset{filled/.style={fill=circle area, draw=circle edge, thick}, outline/.style={draw=circle edge, thick}}

\begin{figure}
\footnotesize\centering
% Set A and B
\begin{tikzpicture}[every text node part/.style={align=center}]
\draw[filled] \firstcircle node { $F$ };
\draw \secondcircle node { };
\node[anchor=south,rectangle] at (current bounding box.north) { All $F$ are $G$ \\ $\forall x(Fx\to Gx)$};
\node at (2.1,0.6) { $G$ };
% \draw (-2.5,-2.5) rectangle (4.5,2.5) node [text=black,above] {$\emptyset$};
\draw (5,0) circle (1cm) node { $F$ };
\draw (7.5,0) circle (1cm) node { $G$ };
\node[anchor=south,rectangle] at (6.25,1) { No $F$ are $G$ \\ $\forall x(Fx\to \neg Gx)$};
\end{tikzpicture}
%\end{figure}
%\begin{figure}
\centering
\begin{tikzpicture}[every text node part/.style={align=center}]
\draw (0,0) circle (1cm) node { $F$ };
\draw (1.5,0) circle (1cm) node { $G$ };
\draw (0.8,0) node { \textbf{x} };
\node[anchor=south,rectangle] at (0.75,1) { Some $F$ are $G$ \\ $\exists x(Fx\wedge Gx)$};
\draw (5,0) circle (1cm) node { $F$ };
\draw (6.5,0) circle (1cm) node { $G$ };
\draw (5,-0.65) node { \textbf{x} };
\node[anchor=south,rectangle] at (5.75,1) { Some $F$ are not $G$ \\ $\exists x(Fx\wedge \neg Gx)$};
\end{tikzpicture}
 \caption{The four standard types of quantified statements\label{venn}}
\end{figure}

\end{document}

我需要增加图像两部分之间的垂直空间,如下所示:

在此处输入图片描述

答案1

只需添加一个不可见的坐标即可。添加\path (0,2);到第二张图片中可得出

\documentclass{book}
\usepackage{tikz}

\begin{document}

\def\firstcircle{(1.5,0) circle (0.6cm)}
\def\secondcircle{(1.5,0) circle (1cm)}

\colorlet{circle edge}{black}
\colorlet{circle area}{gray!20}

\tikzset{filled/.style={fill=circle area, draw=circle edge, thick}, outline/.style={draw=circle edge, thick}}

\begin{figure}
\footnotesize\centering
% Set A and B
\begin{tikzpicture}[every text node part/.style={align=center}]
\draw[filled] \firstcircle node { $F$ };
\draw \secondcircle node { };
\node[anchor=south,rectangle] at (current bounding box.north) { All $F$ are $G$ \\ $\forall x(Fx\to Gx)$};
\node at (2.1,0.6) { $G$ };
% \draw (-2.5,-2.5) rectangle (4.5,2.5) node [text=black,above] {$\emptyset$};
\draw (5,0) circle (1cm) node { $F$ };
\draw (7.5,0) circle (1cm) node { $G$ };
\node[anchor=south,rectangle] at (6.25,1) { No $F$ are $G$ \\ $\forall x(Fx\to \neg Gx)$};
\end{tikzpicture}
%\end{figure}
%\begin{figure}
\centering
\begin{tikzpicture}[every text node part/.style={align=center}]
\path (0,2); %<- added
\draw (0,0) circle (1cm) node { $F$ };
\draw (1.5,0) circle (1cm) node { $G$ };
\draw (0.8,0) node { \textbf{x} };
\node[anchor=south,rectangle] at (0.75,1) { Some $F$ are $G$ \\ $\exists x(Fx\wedge Gx)$};
\draw (5,0) circle (1cm) node { $F$ };
\draw (6.5,0) circle (1cm) node { $G$ };
\draw (5,-0.65) node { \textbf{x} };
\node[anchor=south,rectangle] at (5.75,1) { Some $F$ are not $G$ \\ $\exists x(Fx\wedge \neg Gx)$};
\end{tikzpicture}
 \caption{The four standard types of quantified statements\label{venn}}
\end{figure}

\end{document}

在此处输入图片描述

但是,还有更高级的方法可以实现这一点。例如,您可以使用matrix

\documentclass{book}
\usepackage{tikz}

\begin{document}

\def\firstcircle{(0,0) circle [radius=0.6cm]}
\def\secondcircle{(0,0) circle [radius=1cm]}

\colorlet{circle edge}{black}
\colorlet{circle area}{gray!20}

\tikzset{filled/.style={fill=circle area, draw=circle edge, thick}, outline/.style={draw=circle edge, thick}}

\begin{figure}
\footnotesize\centering
% Set A and B
\begin{tikzpicture}[pics/whatever/.style={code={#1}}]
\matrix[cells={nodes={anchor=center,align=center}},column sep=2em]{
\node {All $F$ are $G$\\ $\forall x(Fx\to Gx)$}; & 
\node {No $F$ are $G$\\ $\forall x(Fx\to \neg Gx)$}; \\
\pic{whatever={
\draw[filled] \firstcircle node { $F$ };
\draw \secondcircle node { };
\node at (45:0.8) { $G$ };
}}; &
\pic{whatever={\draw (-1.25,0) circle [radius=1cm] node { $F$ };
\draw (1.25,0) circle [radius=1cm] node { $G$ };
}}; \\[2em] 
\node{Some $F$ are $G$\\ $\exists x(Fx\wedge Gx)$};
&
\node{Some $F$ are not $G$ \\ $\exists x(Fx\wedge \neg Gx)$};
\\
\pic{whatever={\draw (-0.75,0) circle [radius=1cm] node { $F$ };
\draw (0.75,0) circle [radius=1cm] node { $G$ };
\draw (0,0) node { \textbf{x} };
}};
&
\pic{whatever={
\draw (-0.75,0) circle [radius=1cm] node { $F$ };
\draw (0.75,0) circle [radius=1cm] node { $G$ };
\draw (-0.75,-0.65) node { \textbf{x} };
}};\\
};
\end{tikzpicture}
\caption{The four standard types of quantified statements\label{venn}}
\end{figure}
\end{document}

在此处输入图片描述

相关内容