273

It's my first time working with a two-column document (declared as an argument to \documentclass) and I need to put in a very wide figure. The thing is, LaTeX puts it bounded by a column so it either (1) gets truncated, bleeding off the border or [right column] or (2) displays with an awkward text/line wrapping. Is there any way for me to get it to display the way \maketitle does, that is, at the top of the page (ideally) but at least spanning both columns and no awkward line wrapping?

BTW, I use the following code to display my figure:

\begin{figure}
    \centering
    \includegraphics[width=6in]{tictac.png}
    \caption{\textsf{The structure of our tic-tac-toe implementation.}}
    \label{fig:ds}
\end{figure}
Stefan Kottwitz
  • 231,401
skytreader
  • 3,027
  • 3
  • 16
  • 10
  • 1
    If you do not want to make it complicated, simply under \usepackage{graphicx} you can

    \begin{figure}[!ht] \centering \includegraphics{figures.png} \caption{Caption!} \label{fig:test} \end{figure}

    – bim Jan 24 '21 at 14:13

1 Answers1

358

You need to use the starred version * of the figure environment:

\documentclass[twocolumn]{article}
\usepackage[showframe]{geometry}% http://ctan.org/pkg/geometry
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\begin{document}
\lipsum[1-2]
\begin{figure*}
  \includegraphics[width=\textwidth,height=4cm]{tiger}
  \caption{This is a tiger.}
\end{figure*}
\lipsum[3-10]
\end{document}

enter image description here

This will usually flush the figure to the top of the following page, so there's not much control left to the user for movement. However, this may just be dependent on the user output.

In my opinion, you may be better off (for ease of use) with the multicol package. Then you can specify text (and sectional commands) in a multicols environment (with a mandatory argument specifying the number of columns), while specifying your figures in the usual way. The layout is different, since the content flows now with the multicols environment. However, this may also be user preference.

Here's a minimal working example:

\documentclass{article}
\usepackage[showframe]{geometry}% http://ctan.org/pkg/geometry
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{multicol}% http://ctan.org/pkg/multicols
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\begin{document}
\begin{multicols}{2}
  \lipsum[1-2]
\end{multicols}
\begin{figure*}[h]
  \includegraphics[width=\textwidth,height=4cm]{tiger}
  \caption{This is a tiger.}
\end{figure*}
\begin{multicols}{2}
  \lipsum[3-4]
\end{multicols}
\end{document}

enter image description here

Werner
  • 603,163
  • 3
    Is there a reason you always include CTAN links of the packages? – doncherry Oct 09 '11 at 09:30
  • 14
    @doncherry: I've just grown use to that style since there are many new users to LaTeX on TeX.SX. If they copy and use code, they have a reference to the source of the package. – Werner Oct 09 '11 at 15:00
  • 2
    Alright ... I'm just not sure if a user who doesn't know how to retrieve a package from CTAN would be helped with a standard link to CTAN. We could think about two basic questions (one for each MiKTeX and TeX Live) explaining how to install a package, that you could refer to when necessary? – doncherry Oct 09 '11 at 15:13
  • 7
    @doncherry: The standard CTAN link provides a section called Getting it. This sheds some light on downloading/installation procedures for both MiKTeX & TeX Live. If someone is not capable of following these guidelines, I'm sure they'll post a question specific to this, which will solve the problem. They may even have MiKTeX's texify/pdftexify running to install packages on-the-fly (or use the recently released texliveonfly.py). Regardless, I thought it could only help. – Werner Oct 09 '11 at 15:27
  • 2
    Good point, I hadn't actually visited the links. Thanks for enlightening me :) – doncherry Oct 09 '11 at 15:31
  • 3
    Having lipsum in your code confused me, it worked with changing figure to figure*. – Chamila Wijayarathna Sep 15 '17 at 02:02
  • 1
    @ChamilaWijayarathna: This necessarily places the figure at the top of the (following) page. – Werner Sep 15 '17 at 16:07
  • 1
    Do you mean with lipsum or without lipsum? – Chamila Wijayarathna Sep 16 '17 at 01:09
  • 1
    \lipsum just provides dummy text and is therefore just used in my example to fill the page with some words. Using figure* will put an image at the top of the page by default under the two-column document class option. If the page already has text on it, it'll put it at the top of the following page. – Werner Sep 16 '17 at 01:58
  • CTAN also includes links to user manuals for many packages, which provides valuable information on how to use them that people - myself included until last week - may not be aware of. – starbeamrainbowlabs Jul 13 '23 at 17:29