General ⇒ Need help with table in latex
Need help with table in 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.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Need help with table in latex
Best regards and welcome to the board
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Need help with table in latex
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
Need help with table in latex
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.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?
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