6

I am trying to include a set of tables into my document. Since the tables are quite large, I want them to be on landscape pages, and centered right in the middle of the page (that is, centered in terms of pagewidth and pageheight as well).

This works fine for the second to last table, however, the first table always ends up right on top of the page, which looks rather unpleasant.

The Tex code looks like following:

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{fullpage}
\author{~~~}
\pagestyle{empty}
\usepackage[margin=.01in, landscape]{geometry}
\begin{document}

\input{../stata_outputs/regressions_page_length.tex}
\clearpage

\input{../stata_outputs/regressions_clicks.tex}
\clearpage

[...]

\end{document}

The input files are automatically generate by Stata, and en excerpt looks like this:

\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{page\_length after 0 weeks}
\begin{tabular*}{25cm}{@{\hskip\tabcolsep\extracolsep\fill}l*{5}{c}}
\toprule
&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}&\multicolumn{1}{c}{(5)}\\
&\multicolumn{1}{c}{control"}&\multicolumn{1}{c}{+local}&\multicolumn{1}{c}{+global}&\multicolumn{1}{c}{plus}&\multicolumn{1}{c}{all}\
[...]


\bottomrule
\multicolumn{6}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{6}{l}{\footnotesize * p<0.10, ** p<0.05, *** p<0.010}\\
\end{tabular*}
\end{table}

Is there any way that I could force Latex to put these tables exactly where I want them, preferrably by setting an option in the main file? Editing each individual input file is not really an option, since the are generated multiple times a day...

  • 2
    Can you set up Stata so that the tables it outputs have [p] positioner instead of [htpb]? – JLDiaz Jul 25 '12 at 9:25
  • How come your tables are not centered? In the table environment there is the command \centering which centers them.. Or is this not the case in every table? – Didii Jul 25 '12 at 9:34
  • @Didii \centering is for horizontal placement. – egreg Jul 25 '12 at 9:36
5

You should be OK if only [p] is specified as the positioning argument, because the contents of page of floats is always centered vertically.

If it's not possible to set up Stata so that it outputs \begin{figure}[p] for this particular document, then adding the following code to the preamble should force it anyway:

\let\latextable\table
\renewcommand\table[1][]{\latextable[p]}

Note: if you can convince Stata to say

\def\sym#1{\ensuremath{^{#1}}

your document will be more robust. This is one of the few cases when \ensuremath is really useful.

  • Thank you very much. Unfortunately, altering the output from Stata is tedious, if not impossible. However, the first command that you suggested to me worked great. – padrino Jul 25 '12 at 9:42
  • 3
    @Benedikt That is not true. You are using Ben Jann's estout package which allows complete control over the table specifications, in your case using the prehead(\begin{table}[p]) option. Close this off with the postfoot(\end{table}) option. – tchakravarty Jul 25 '12 at 9:49
  • Also thank you, Fg Nu. I flat out oversaw that option. – padrino Jul 25 '12 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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