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'm in a 2-column environment. I need to use the entire pagewidth (\textwidth) while importing a table with \includegraphics.

\begin{table}
\centering
\includegraphics[width=\textwidth]{./myfile.pdf}
\caption{Beautiful stuff here}
\label{tab:myfile}
\end{table}

(I have tried tabular* without success.)

share|improve this question
    
Perhaps you meant textwidth instead of pagewidth? –  Gonzalo Medina Aug 27 '12 at 1:56
    
Not sure. Want it to use the whole page (less the margins). –  Jodi Schneider Aug 27 '12 at 1:59
    
Interestingly, pagewidth seems to break while textwidth doesn't, with table*. Hmm... –  Jodi Schneider Aug 27 '12 at 2:02
    
Then yes, it's textwidth (the width of the area reserved for text). Are you using the multicol package as one of the tags suggests? –  Gonzalo Medina Aug 27 '12 at 2:02
2  
There's no \pagewidth dimension; there is \paperwidth (the total width of the physical page), but according to a previous comment you need is \textwidth. –  Gonzalo Medina Aug 27 '12 at 2:26

2 Answers 2

The multicols environment doesn't completely support floats; you can

  1. Use the starred version of floats (table* or figure*) but the float will appear on the top of the next page:

    \documentclass{article}
    \usepackage{multicol}
    \usepackage[demo]{graphicx}
    \usepackage{lipsum}
    
    \begin{document}
    
    \begin{multicols}{2}
    \lipsum[4]
    \begin{table*}
    \centering
    \setlength\fboxsep{0pt}
    \includegraphics[width=\textwidth]{./myfile.pdf}
    \caption{Beautiful stuff here}
    \label{tab:myfile}
    \end{table*}
    \lipsum[4]
    \end{multicols}
    
    \end{document}
    
  2. End the multicols, typeset the table inside, for example, a minipage or a center environment (\captionof from the capt-of or caption packages can be used to provide a caption) and then start another multicols:

    \documentclass{article}
    \usepackage{multicol}
    \usepackage{caption}
    \usepackage[demo]{graphicx}
    \usepackage{lipsum}
    
    \begin{document}
    
    \begin{multicols}{2}
    \lipsum[4]
    \end{multicols}
    \begin{center}
    \setlength\fboxsep{0pt}
    \includegraphics[width=\textwidth]{./myfile.pdf}
    \captionof{table}{Beautiful stuff here}
    \label{tab:myfile}
    \end{center}
    \begin{multicols}{2}
    \lipsum[4]
    \end{multicols}
    
    \end{document}
    

enter image description here

Remark:

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

share|improve this answer

I thought I'd tried this already -- but table* seems to be doing what I want:

\begin{table*}
\centering
\includegraphics[width=\textwidth]{./myfile.pdf}
\caption{Beautiful stuff here}
\label{tab:myfile}
\end{table*}

Other approaches?

share|improve this answer
    
I've updated my answer with the only two (as far as I know) options available when using multicols. –  Gonzalo Medina Aug 27 '12 at 2:56
1  
Why are you setting \fboxsep to zero? This parameter has no role whatsoever in what you're doing. –  egreg Aug 27 '12 at 9:26
    
No idea. Thanks for the feedback! :) –  Jodi Schneider Aug 28 '12 at 14:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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