GeneralNeed help with table in latex

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
booji
Posts: 2
Joined: Tue Sep 09, 2008 11:22 pm

Need help with table in latex

Post by booji »

Hi, i am new to this website and to latex, and i was wondering if i could get some help on latex.

i am trying to produce a table with caption on top. However, my caption right now is much wider than the width of the table itself, so i was wondering if any of you know how to get the caption to have the same width as the table's? My code is the following.

\begin{sidewaystable} [h]
\centering
\begin{center}
\caption [short caption] {The Fama and French 3 facotrs model is estimated for each firm during the pre-event period from day -130 to day -11. Abnormal returns are then computed for each firm based on Fama and French 3 factors model risk adjustments. Daily abnormal returns are averaged across firms and cumulated. Panel A's sample includes XXX firms and Panel B's sample includes YYY firms.}
\begin{tabular}{c c c c}
\hline \\%inserts single horizontal lines
Event Period (days) & Average Daily & t-statistic & Wilcoxon sign test \\[2ex]
& Abnormal Return \\[2ex]
%heading
\hline \\% inserts single horizontal line\textcolor[rgb]{0.00,0.00,0.00}{}
\multicolumn{4}{c}{Panel A: The proposal was rejected} \\[0.5ex]

\hline \\[2ex] %inserts single line

\hline \\[0.8ex]
\multicolumn{4}{c}{Panel B: The proposal was Accepted} \\[0.5ex]
\hline \\[2ex]

\hline
\multicolumn{4}{l}{$^{***}$, $^{**}$, $^{*}$, indicate significance at the 5 and 10 percent levels, respectively.} \\[0.5ex]
\end{tabular}
\end{center}
\end{sidewaystable}


thanks for your help, really appreciate it.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Need help with table in latex

Post by localghost »

I wonder why you are producing this as a rotated table. Actually this table fits the page width in portrait format. But this may be a matter of page geometry. A possible solution comes with the caption package, which lets you - also locally - customize your captions in many ways. As far as I know the sidwaystable environment doesn't accept any optional arguments.


Best regards and welcome to the board
Thorsten¹
booji
Posts: 2
Joined: Tue Sep 09, 2008 11:22 pm

Re: Need help with table in latex

Post by booji »

thanks for the prompt reply.

The reason i am using rotated table is because i have other pages which are just the normal essay style stuffs (mainly text). If there is a way that i could make only 1 page to become portrait, that would be great.

Also, i just started to use latex yesterday, so i am not too familiar with the options on caption you mentioned. But before i started the table, i put down the code

\usepackage[font=sf, labelfont={sf,bf}, margin=1cm]{caption}

Are there any other options i can put into this code so that my caption would share the same width as my tables?

thanks alot
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Need help with table in latex

Post by sommerfee »

booji wrote:Are there any other options i can put into this code so that my caption would share the same width as my tables?
Since the caption package just takes care about the caption itself it knows nothing around the surrounding of the caption, so it can't offer such things.

But there are table packages which offer this functionality, e.g. the threeparttable, the floatrow, and the ctable package. (I'm sure there are even more but these are the ones I'm aware off.)

Axel
Post Reply