Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to add a figure (a center environment) two a \twocolumn command. I tried this:

\documentclass[10pt,twocolumn]{article}
\usepackage{graphicx}
\usepackage{subfig}

\begin{document}

\twocolumn[{%
\begin{center}
\captiontype{figure}
\subfloat[]
  {
  \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} }
  }
\subfloat[]
  {
  \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} }
  }
\caption{Our algorithms.}
\end{center}
}] %end twocolumn

\end{document}

but I get "undefined control sequence }]". Any suggestions?

share|improve this question

closed as too localized by egreg, Gonzalo Medina, cmhughes, lockstep, yo' May 5 '12 at 11:19

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
The undefined control sequence is \captiontype. What precisely do you want to do? –  egreg May 4 '12 at 17:26
    
Bah, sorry. I didn't realize there was a different output tab. Is there a way to delete this question? It surely is not useful for others. –  David Doria May 4 '12 at 17:31

1 Answer 1

If you're interested in posting an object across two columns in the \twocolumn macro, it should be void of any floats. Here's an option by setting the contents of the two-column spread without resorting to \subfloat. Accurate referencing capability can be incorporated, if needed.

enter image description here

\documentclass[10pt,twocolumn]{article}
%\usepackage{graphicx}% http://ctan.org/pkg/graphicx
%\usepackage{subfig}% http://ctan.org/pkg/subfig
\usepackage{caption}% http://ctan.org/pkg/caption
\usepackage{lipsum}% http://ctan.org/pkg/lipsum

\begin{document}

\twocolumn[{%
\hfill%
\parbox{.4\textwidth}{\centering%
  \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} } \\[\abovecaptionskip]
  \small (a)
}%
\hfill%
\parbox{.4\textwidth}{\centering%
  \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} } \\[\abovecaptionskip]
  \small (b)
}%
\hspace*{\fill}
\captionof{figure}{Our algorithms.}
%\end{center}
}] %end twocolumn

\lipsum[1-5]

\end{document}

The horizontal alignment is performed using \hfill, while the contents of the "subfloats" are set inside a \parbox. This allows for using a paragraph break (via \\[\abovecaptionskip]).

The caption package provides the caption as needed without being inside a floating environment, while lipsum generates some dummy text.

There are other ways of having a single-column figure (float) in a two-column document (via figure*). Although the placement of such floats might be not what the users wants.

share|improve this answer
    
What is wrong with having floats inside the \twocolumn? –  David Doria May 4 '12 at 17:41
    
@DavidDoria: There's nothing wrong, but if you want a single-column float in the \twocolumn document, the placement is not always are requested. See Wide figures in two-column documents. –  Werner May 4 '12 at 17:44

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