Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: -tabout- excess space between caption and first line


From   Eric Booth <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: st: -tabout- excess space between caption and first line
Date   Thu, 14 Apr 2011 00:41:49 +0000

<>
Michael:

I cannot replicate the extra space you describe with the code you have provided.  Can you please provide the -tabout- syntax you used as well as the entire LaTeX syntax?
Using the -tabout- code below, I got the LaTeX code below that (using top.tex and bot.tex from Ian Watson's documentation), and compiled it using pdflatex with texshop for Mac OSX 10.6 -- the resulting table did not have a large gap between the caption and the \toprule line. I've put a copy of the .tex, .do, and resulting .pdf in my dropbox (links provided below).

The gap might be due to (1) something in your -tabout- syntax or (2) something in your LaTeX document that is dictating the space between the caption and the label  (e.g., something in your preamble or a \usepackage{} that you included (?)), but it's hard to tell.


**************************BEGIN Stata -tabout- code
sysuse nlsw88.dta, clear
tabout coll smsa south race using table1.tex, replace /// 
	c(col) f(1p) clab(Col%) stats(chi2) npos(lab) ptotal(both)  ///
	style(tex) bt font(bold) cl1(2-5)  /// 
	topf(top.tex) botf(bot.tex) topstr(12cm) botstr(10cm)
type table1.tex
**************************END Stata -tabout- code



*********************************BEGIN LATEX CODE
\documentclass[10pt]{article}
\usepackage{geometry, booktabs, tabularx, graphicx, epstopdf}    

\begin{document}
\begin{table}[htbp]
\centering
\caption{test caption table title here  }
\footnotesize 
\newcolumntype{Y}{>{\raggedleft\arraybackslash}X} 
\begin{tabularx} {12cm} {@{} l X Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}} \\ 
\toprule
 & \multicolumn{4}{c}{\textbf{race}} \\
\cmidrule(l{.75em}){2-5} 
&\textbf{white}&\textbf{black}&\textbf{other}&\textbf{Total} \\
&Col\%&Col\%&Col\%&Col\% \\
\midrule
\textbf{college graduate}&&&& \\
not college grad (n=1,714)&74.3\%&82.3\%&65.4\%&76.3\% \\
college grad (n=532)&25.7\%&17.7\%&34.6\%&23.7\% \\
\textbf{Total} (n=2,246)&100.0\%&100.0\%&100.0\%&100.0\% \\
\midrule
Pearson chi2(2) =& 16.9189 &Pr =& 0.000& \\
\midrule
\textbf{lives in SMSA}&&&& \\
nonSMSA (n=665)&31.3\%&24.9\%&26.9\%&29.6\% \\
SMSA (n=1,581)&68.7\%&75.1\%&73.1\%&70.4\% \\
\textbf{Total} (n=2,246)&100.0\%&100.0\%&100.0\%&100.0\% \\
\midrule
Pearson chi2(2) =& 8.7161 &Pr =& 0.013& \\
\midrule
\textbf{lives in south}&&&& \\
0 (n=1,304)&65.4\%&36.0\%&88.5\%&58.1\% \\
1 (n=942)&34.6\%&64.0\%&11.5\%&41.9\% \\
\textbf{Total} (n=2,246)&100.0\%&100.0\%&100.0\%&100.0\% \\
\midrule
Pearson chi2(2) =& 162.6246 &Pr =& 0.000& \\
\bottomrule 
\addlinespace[.75ex] 
%\scriptsize{10cm} 
\end{tabularx} 
\label{tab:LPer}
\end{table}
\normalsize 
\end{document}  
******************************END LATEX CODE

Download these files (in a zip archive from my DropBox) with this link:

http://dl.dropbox.com/u/428249/110413_taboutexample.zip



- Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754


On Apr 13, 2011, at 6:15 PM, Michael Crain wrote:

> I am using Ian Watson's -tabout- to create a table in Tex format. After compiling the Tex file in LaTex, the table looks fine except the spacing under the caption to the first horizontal line is too great. The gap is not trivial. It is about 0.3 inches and obviously too much. I've got other tables in my Tex document created using -esttab_ where the caption spacing appears normal. Even if I had to live with the excess spacing in this table, it makes my other tables appear inconsistent.
> 
> I can't figure out how to control the caption spacing in the table created by -tabout-. The first part of the relevant Tex code generated by -tabout- is below.  Has anyone else encountered this issue and been able to overcome it?
> 
> begin{table}[htbp]
>   \centering
>   \footnotesize
>   \caption{My caption is here}
> \begin{center}
> \footnotesize
> \newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
> \begin{tabularx} {12cm} {@{} l Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}} \\
> \toprule
> 		 	   		  
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/




*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index