我的代码如下。我想增加两个图之间的距离:
\PassOptionsToPackage{usenames,dvipsnames,svgnames,table}{xcolor}
\documentclass [11pt,a4paper] {article}
\usepackage{amsmath,tikz}
\usetikzlibrary{patterns,matrix,arrows,positioning}
\begin{document}
\begin{figure}[!htb]
\centering
\subfigure[Before]
{%
\begin{tikzpicture}[->,
>=stealth',
shorten >=1pt,
auto,
node distance=3cm,
thick,
main node/.style={
circle,
fill=RoyalBlue!90!green!80,
draw,
font=\sffamily\Large\bfseries}
]
\node[main node,label=below:Cause] (y) {$Y$};
\node[main node,label=below:Effect,right of=y] (x) {$X$};
\node[above=1cm of x] (nx) {$N_X$};
\node[above=1cm of y] (ny) {$N_Y$};
\path (y) edge[right] node[below right,font=\sffamily\small] {} (x);
% \path (x) edge[bend right,orange]node[above,font=\sffamily\small,orange]{}(y);
\path (nx) edge[blue] node[left,font=\sffamily\small,orange] {} (x);
\path (ny) edge[blue] (y);
\end{tikzpicture}\label{fig:FCM}
%\caption{General Functional Causal Model for two 1D variables}
}
\subfigure[After]
{%
\begin{tikzpicture}[->,
>=stealth',
shorten >=1pt,
auto,
node distance=3cm,
thick,
main node/.style={
circle,
fill=RoyalBlue!90!green!80,
draw,
font=\sffamily\Large\bfseries}
]
\node[main node,label=below:Cause] (y) {$Y$};
\node[main node,label=below:Effect,right of=y] (x) {$X$};
\path (y) edge[right] node[below right,font=\sffamily\small] {$\varphi$} (x);
\path (x) edge[bend right,orange] node[above,font=\sffamily\small,color=orange] {$\varphi^{-1}$} (y);
\end{tikzpicture}
}
\end{figure}
\end{document}
答案1
在两个subfigure
s 之间,您可以使用\quad
、\qquad
、\hspace{<length>}
(其中<length>
是任意有效长度)或者甚至\hfill
:
\documentclass [11pt,a4paper] {article}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{amsmath,tikz}
\usepackage{subfigure}
\usetikzlibrary{patterns,matrix,arrows,positioning}
\begin{document}
\begin{figure}[!htb]
\centering
\subfigure[Before]
{%
\begin{tikzpicture}[->,
>=stealth',
shorten >=1pt,
auto,
node distance=3cm,
thick,
main node/.style={
circle,
fill=RoyalBlue!90!green!80,
draw,
font=\sffamily\Large\bfseries}
]
\node[main node,label=below:Cause] (y) {$Y$};
\node[main node,label=below:Effect,right of=y] (x) {$X$};
\node[above=1cm of x] (nx) {$N_X$};
\node[above=1cm of y] (ny) {$N_Y$};
\path (y) edge[right] node[below right,font=\sffamily\small] {} (x);
% \path (x) edge[bend right,orange]node[above,font=\sffamily\small,orange]{}(y);
\path (nx) edge[blue] node[left,font=\sffamily\small,orange] {} (x);
\path (ny) edge[blue] (y);
\end{tikzpicture}\label{fig:FCM}
%\caption{General Functional Causal Model for two 1D variables}
}\hfill
\subfigure[After]
{%
\begin{tikzpicture}[->,
>=stealth',
shorten >=1pt,
auto,
node distance=3cm,
thick,
main node/.style={
circle,
fill=RoyalBlue!90!green!80,
draw,
font=\sffamily\Large\bfseries}
]
\node[main node,label=below:Cause] (y) {$Y$};
\node[main node,label=below:Effect,right of=y] (x) {$X$};
\path (y) edge[right] node[below right,font=\sffamily\small] {$\varphi$} (x);
\path (x) edge[bend right,orange] node[above,font=\sffamily\small,color=orange] {$\varphi^{-1}$} (y);
\end{tikzpicture}
}
\end{figure}
\end{document}
顺便说一句,subfigure
是一个过时的包;你应该使用subcaption
或subfig
代替。还请注意,你可以xcolor
使用你的选项加载前 tikz
以标准方式,因此您不必使用\PassOptionsToPackage
。