5

I'm restricted to writing a paper with\documentclass[twocolumn,11pt]{article}, but I want to create a tikzpicture that spans across both of the columns, filling the width of the page. I have tried placing it in a figure and using figure*, and other figure options, but none of that works.

The code for my tikzpicture is here.

\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}
  • 3
    What's precisely the problem with figure*? – egreg Dec 21 '13 at 12:16
  • @egreg a tikzpicture in a figure* takes on the column width, not the figure width. – JAB Apr 27 '16 at 17:40
  • @JAB A tikzpicture takes its own width. – egreg Apr 27 '16 at 17:44
  • @egreg You seem to be correct, I thought I had observed the dimensions changing based on column size but after some more experimentation it seems not. – JAB Apr 27 '16 at 17:47
  • @JAB In Jesse's solution, the picture is magnified by adjustbox – egreg Apr 27 '16 at 17:48
10

This is a way to span the tikzpicture across two column. adjustbox package is used where the width is set to \linewidth for the span. width=\columnwidth would back to regular result.

enter image description here

Code

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.