# Put a vertical line to separate 2 subgraphs

I have one figure which contains 2 figures:

\begin{figure*}
\begin{center}
\subfigure[A]{
\begin{tikzpicture}
....
\end{tikzpicture}
}
\subfigure[B]{
\begin{tikzpicture}
....
\end{tikzpicture}
}
\end{center}
\end{figure*}


Could anyone tell me how to add a vertical line between them to visually separate them?

-
A tabular with {c|c} maybe? – percusse Mar 5 '13 at 22:16
Can I still keep subfigure inside tabular? – SoftTimur Mar 5 '13 at 22:38
@SoftTimur Yes, you can. Note that the subfigure package is obsolete and either subfig or subcaption should be used; the former has a syntax like subfigure (but you should use \subfloat instead of \subfigure). There are many spurious spaces in your code. – egreg Mar 5 '13 at 22:48
Regarding the spurious spaces, do you mean I should add % after {? – SoftTimur Mar 5 '13 at 22:51

Following the advice of percusse and egreg:

\documentclass{article}

\usepackage{tikz}
\usepackage{subcaption}

\begin{document}
\begin{figure}
\centering
\begin{tabular}{c|c}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\begin{tikzpicture}
\fill[red] (0,0) rectangle (3,3);
\end{tikzpicture}
\caption{A red square}
\label{fig:red_square}
\end{subfigure}
&
\begin{subfigure}[b]{0.45\textwidth}
\centering
\begin{tikzpicture}
\fill[blue] (0,0) rectangle (3,3);
\end{tikzpicture}
\caption{A blue square}
\label{fig:blue_square}
\end{subfigure}
\end{tabular}
\caption{Two squares}
\label{fig:two_squares}
\end{figure}
\end{document}


-
Thank you... But if you put \begin{subfigure}[A longer Text]{0.45\textwidth}, it seems that the labels under the figures are not well placed... – SoftTimur Mar 5 '13 at 23:18
The optional argument of the subfigure environment does not correspond to its caption, but to a placement specifier; see the table summarising those options on en.wikibooks.org/wiki/LaTeX/…. If you want to add a caption to each subfigure, and possibly to the figure that contains them, simply use \caption as in my code, which I just updated. – Jubobs Mar 5 '13 at 23:37