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 writing a paper that includes a number of tables. Until now these have been in standard table* format, i.e.

\begin{table*}
\caption{Caption}
\label{label}
\begin{center}
\begin{tabular}{lccccccccccccccc|cc}
& \multicolumn{15}{c}{Title}& $\mu$ & $\sigma$\\

etc.

with about 15-20 subsequent rows, and renders correctly while (just) fitting the page width. However, I now need to add two further columns, making the table* too wide for portrait, and so need to switch to landscape mode. This should be a straightforward case of rotating through 90 degrees, as even in landscape there are not so many rows that the table needs to break across pages.

However, I've tried two approaches and have hit problems with both. Firstly, I have tried wrapping the table with \begin{landscape} (including lscape in \usepackage), but there is a lot of whitespace at the bottom of the page, while the left hand edge of the table is pushed through the \runningtitle and off the top of the page. Secondly, I tried replacing \begin{table*} with \begin{sidewaystable*}, but now the table is correctly spaced vertically (i.e. there is not excessive whitespace at the bottom, or a collision with \runningtitle) but is now offset horizontally - the first table runs off the 'left' of the page (left as viewed in portrait, top as viewed in landscape) while the next is rotated 180 degrees and drops off the 'right'.

In both cases, adding or removing \begin{center} or \centering doesn't appear to make any difference, and I'm out of ideas about what else to do. Apart from the usual LaTeX complaints about 'float too large for page' there is no apparent output to help me figure out what's wrong. The paper is in A&A format using the latest (v7) aa.cls. If I switch to referee mode (which triggers a shift from two-column to one-column with larger font and double spacing) then the table appears to render correctly, which makes me wonder if there's some issue with the .cls file.

Does anybody have any suggestions for a solution, workaround or alternative that might just work? I've been bashing my head against this for a couple of hours and I'm no out of ideas.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Instead of using table*, you could try tabular*. The *-form takes an additional <width> mandatory argument

\begin{tabular*}{<width>}{<column specification>}

which specifies the width of the tabular environment; in the regular form the width is determined by LaTeX from the contents of the tabular environment. Now, this might only help if you actually want to widen a table/tabular to a specific width. But, in your case you may need to shrink the table/tabular width. For this, there may be some tricks you can employ. However, some of these may be dependent on the journal requirements/specifications. Also, optimal solutions/choice might depend on the degree that your table extends outside the text block. I list a couple here by means of an example:

\documentclass[12pt]{article}
\usepackage{graphicx}
\begin{document}
Original\par
\begin{tabular}{*{7}{|c}|}
  Test 1 & Test 2 & Test 3 & Test 4 & Test 5 & Test 6 & Test 7
\end{tabular}

\bigskip Individual column separation modified via \verb|@{\hspace{<width>}}|\par
\begin{tabular}{*{7}{|@{\hspace{2pt}}c@{\hspace{2pt}}}|}
  Test 1 & Test 2 & Test 3 & Test 4 & Test 5 & Test 6 & Test 7
\end{tabular}

\bigskip Global column separation modified via \verb|\renewcommand{\tabcolsep}{<width>}|\par
{\renewcommand{\tabcolsep}{2pt}
\begin{tabular}{*{7}{|c}|}
  Test 1 & Test 2 & Test 3 & Test 4 & Test 5 & Test 6 & Test 7
\end{tabular}}

\bigskip Resized horizontally (keeping aspectratio) via \verb|\resizebox{<width>}{<height>}|\par
\resizebox{20em}{!}{\begin{tabular}{*{7}{|c}|}
  Test 1 & Test 2 & Test 3 & Test 4 & Test 5 & Test 6 & Test 7
\end{tabular}}

\bigskip Original\par
\begin{tabular}{*{7}{|c}|}
  Test 1 & Test 2 & Test 3 & Test 4 & Test 5 & Test 6 & Test 7
\end{tabular}
\end{document}

Differences in horizontal spacing when using the tabular environment

On a more semantic side of things, here are some suggestions to your code:

  • The use of \begin{center}...\end{center} is antiquated in LaTeX, and often produces unwanted vertical spacing even though this might not be the case with your tables. Rather use \centering. The l2tabu package gives some mention of this, plus other references to obsolete code for LaTeX2e.
  • Tabular columns specification can be simplified if you have many similarly-formatted columns. For this, using *{15}{c} is equivalent to ccccccccccccccc (as in the example above). Of course, there is a limit to this use, since *{2}{c} is less useful than cc. However, readibility is at play here as well as ease of subsequent modification.
share|improve this answer
add comment

here's a technique we've found to work with table, though i don't know whether it's been tried with table*.

use these packages:

\usepackage{graphicx}
\usepackage{lscape}

When constructing the object to be rotated, start by placing it, along with its caption, into a minipage with a width of \textheight, then wrap it in the landscape environment to rotate the minipage by 90 degrees. For example,

\begin{landscape}
\begin{table}
 \begin{minipage}{\textheight}
  \caption{...}\label{...}
  ...
 \end{minipage}
\end{table}
\end{landscape} 

Note: The landscape environment must be outside the float environment (table or figure). Thus, it must occur at an explicit page break.

Measure the width of the object and replace \textheight by that width, to ensure optimal positioning, e.g.:

\begin{minipage}{6.5in} 

(The maximum width accommodated by (most) AMS document classes is 7.5 inches. You should determine the appropriate value for the document class you're using; \textheight won't work directly, although saving that value in another dimension register beforehand probably would.)

This technique minimizes extra space between the right side of the floating object and the running head.

(these instructions were adapted from the AMS author FAQ, which has many hints that, while largely AMS-specific, may also be relevant within other LaTeX environments.)

share|improve this answer
    
Thanks, i've just inherited a last-minute grant proposal (aren't they all?) so haven't had a chance to try yet, but will report back when I do –  strmqm Aug 2 '11 at 7:42
add comment

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.