Graphics, Figures & TablesTikz Package and Two Column Enviroment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
s.david
Posts: 43
Joined: Thu Sep 10, 2009 5:22 pm

Tikz Package and Two Column Enviroment

Post by s.david »

Hello,

I have the following piece of code, where it is intended to place the figure drawn using the tikz package in one of the two columns:

Code: Select all

\documentclass[a4paper]{article}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{through}
\begin{document}
\begin{multicols}{2}
\begin{figure*}%* is used because without it the figure does not appear
\begin{center}
\begin{tikzpicture}[scale=0.75,>=latex']

    \node (source) at (0,0) [circle,double distance=1pt,line width=1.5pt,draw,label=below:Source] {$S$};
    \node (relay) at (4,2) [circle,double distance=1pt,line width=1.5pt,draw,label=above:Relay] {$R$};
    \node (destination) at (8,0) [circle,double distance=1pt,line width=1.5pt,draw,label=below:Destination] {$D$};

    \draw [double distance=0.5pt,line width=1.5pt,->] (source.60) to node [auto] {$\mathbf{H}_1$} (relay.west);
    \draw [double distance=0.5pt,line width=1.5pt,->] (relay.east) to node [auto] {$\mathbf{H}_2$} (destination.120);
    \draw [double distance=0.75pt,line width=1.5pt,->] (source.east) to node [auto,swap] {$\mathbf{H}_0$} (destination.west);
\end{tikzpicture}
\caption{Multiple-antenna dual-hop cooperative diversity system}
\label{Cooperative Diversity System2}
\end{center}
\end{figure*}
\end{multicols}
\end{document}


How can we do that?

Thanks in advance

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Tikz Package and Two Column Enviroment

Post by gmedina »

Hi,

the use of the \captionof command (provided by the caption package) and of a minipage could be an option:

Code: Select all

\documentclass[a4paper]{article}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{through}
\usepackage{lipsum}% just to generate some text

\begin{document}

\begin{multicols}{2}

\noindent\begin{minipage}{\linewidth}
\begin{tikzpicture}[xscale=0.45,yscale=0.75,>=latex']
    \node (source) at (0,0) [circle,double distance=1pt,line width=1.5pt,draw,label=below:Source] {$S$};
    \node (relay) at (4,2) [circle,double distance=1pt,line width=1.5pt,draw,label=above:Relay] {$R$};
    \node (destination) at (8,0) [circle,double distance=1pt,line width=1.5pt,draw,label=below:Destination] {$D$};

    \draw [double distance=0.5pt,line width=1.5pt,->] (source.60) to node [auto] {$\mathbf{H}_1$} (relay.west);
    \draw [double distance=0.5pt,line width=1.5pt,->] (relay.east) to node [auto] {$\mathbf{H}_2$} (destination.120);
    \draw [double distance=0.75pt,line width=1.5pt,->] (source.east) to node [auto,swap] {$\mathbf{H}_0$} (destination.west);

\end{tikzpicture}
\captionof{figure}{Multiple-antenna dual-hop cooperative diversity system}
\label{fig:CDS2}
\end{minipage}

\lipsum[1]

\end{multicols}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply