TikZ 图片横跨两列

TikZ 图片横跨两列

我只能用 写一篇论文\documentclass[twocolumn,11pt]{article},但我想创建一个tikzpicture横跨两列的,填满整个页面宽度的。我试过把它放在 中,figure并使用figure*和其他图形选项,但都不起作用。

我的代码tikzpicture在这里。

\definecolor {processblue}{cmyk}{0.96,0,0,0}
\begin {center}
\begin {tikzpicture}[-latex ,auto ,node distance =1.8cm and 1.5cm ,on grid ,
semithick ,
state/.style ={ circle ,top color =white , bottom color = processblue!20 ,
draw,processblue , text=blue , minimum width =1 cm}]
\node[state] (S) {$S$};
\node[state] (W) [above right =of S] {$W$};
\node[state] (X) [right =of W] {$X$};
\node[state] (Y) [right =of X] {$Y$};
\node[state] (Z) [right =of Y] {$Z$};
\node[state] (D) [below right =of Z] {$D$};
\path (S) edge [bend left =0] node[above left = .3 cm] {$R_{sw}$} (W);
\path (W) edge  [bend right =0](S);
\path (W) edge [bend left =0] node[above = .3 cm] {$R_{wx}$}(X);
\path (X) edge [bend right =0](W);
\path (X) edge [bend left =0] node[above = .3 cm] {$R_{xy}$}(Y);
\path (Y) edge [bend right =0](X);
\path (Y) edge [bend left =0] node[above = .3 cm] {$R_{yz}$}(Z);
\path (Z) edge [bend right =0](Y);
\path (Z) edge [bend left =0] node[above right = .3 cm] {$R_{zd}$}(D);
\path (D) edge [bend right =0](Z);
{\tiny }\end{tikzpicture}
\end{center}

答案1

这是一种跨越两列的方法tikzpictureadjustbox使用包来设置\linewidth跨度的宽度。width=\columnwidth将返回常规结果。

在此处输入图片描述

代码

\documentclass[twocolumn,11pt]{article}
\usepackage{tikz}
\usepackage{lipsum,adjustbox}
\usetikzlibrary{calc,positioning}
\begin{document}
\definecolor {processblue}{cmyk}{0.96,0,0,0}
\begin {figure*}%[!hbtp]
\centering
\begin{adjustbox}{width=\textwidth}
\begin {tikzpicture}[-latex ,auto,node distance =1.8cm and 1.5cm ,on grid,semithick,
state/.style ={ circle ,top color =white , bottom color = processblue!20,
draw,processblue , text=blue , minimum width =1 cm}]
\node[state] (S) {$S$};
\node[state] (W) [above right =of S] {$W$};
\node[state] (X) [right =of W] {$X$};
\node[state] (Y) [right =of X] {$Y$};
\node[state] (Z) [right =of Y] {$Z$};
\node[state] (D) [below right =of Z] {$D$};
\path (S) edge [bend left =0] node[above left = .3 cm] {$R_{sw}$} (W);
\path (W) edge  [bend right =0](S);
\path (W) edge [bend left =0] node[above = .3 cm] {$R_{wx}$}(X);
\path (X) edge [bend right =0](W);
\path (X) edge [bend left =0] node[above = .3 cm] {$R_{xy}$}(Y);
\path (Y) edge [bend right =0](X);
\path (Y) edge [bend left =0] node[above = .3 cm] {$R_{yz}$}(Z);
\path (Z) edge [bend right =0](Y);
\path (Z) edge [bend left =0] node[above right = .3 cm] {$R_{zd}$}(D);
\path (D) edge [bend right =0](Z);
{\tiny }
\end{tikzpicture}
\end{adjustbox}
\end{figure*}
\lipsum[1-6]
\end{document}

相关内容