LaTeX forum ⇒ Graphics, Figures & TablesConfiguring a Table and Section Header

Information and discussion about graphics, figures & tables in LaTeX documents.
sonofaselkie
Posts: 1
Joined: Fri Mar 17, 2023 10:30 pm

Configuring a Table and Section Header

Postby sonofaselkie » Fri Mar 17, 2023 10:35 pm

Hello!

I found this post: https://latex.org/forum/viewtopic.php?t=34299, which detailed combining a section header and a sideways table on the same page. It has somewhat worked for me, but there are two issues I cannot figure out.
First, there is a gap between the 'edge' of my table (top when viewed vertically) and the section header. Second is that my table seems to ignore the right margin, and as such extends so far 'down' that it cuts off the bottom of my caption.
I've attached my latex code here:

Ideally, I would like the table to run right up to the results header and abide by the margins set forth on the page. Additionally, the toprule, midrule, and bottomrule all stop partway through the table for some reason.

Best,

Ronan


\section{Results}
\vfill
\begin{center}
	\begin{sideways}
		\begin{minipage}{\linewidth}
	\captionof{table}{Regression Table}
	\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}@{}llllllll@{}}
		\toprule
		& Complete & \multicolumn{2}{c}{25th Percentile} & \multicolumn{2}{c}{50th Percentile} & \multicolumn{2}{c}{75th Percentile} \\
		\cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8}
		& Dataset & Under 25th   & Over 25th & Under 50th & Over 50th & Under 75th & Over 75th   \\
		\midrule
		VET    &   .5257***    & 1.011*      & .4971***    & .3728       & .5856***    & .2243       & .5976***    \\
		&	(0.07)	&	(0.50)       & (0.08)      & (0.27)      & (0.10)      & (0.17)      & (0.14)                   \\
		POP  &   1.5e-07***     & 2.1e-07***  & 5.0e-07***  & 1.7e-07***  & 5.2e-07***  & 1.5e-07***  & 5.1e-07***  \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		WHITE   &   .000377**  & -5.6e-06    & .00099***   & .000159     & .001065***  & .00009      & .00178***   \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		UNIT &  -8.2e-07**      & -1.1e-06*** & -2.6e-06*** & -9.2e-07*** & -2.7e-06*** & -8.1e-07*** & -2.6e-06*** \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		INC  &   4.4e-06***     & 5.7e-06***  & 3.4e-06***  & 5.5e-06***  & 2.2e-06***  & 5.2e-06***  & 1.4e-06***  \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		COST &    .000732***    & .000568***  & .000903***  & .000622***  & .000985***  & .000672***  & .001028***  \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		Constant &  10.69***   & 10.85***    & 10.5***     & 10.79***    & 10.46***    & 10.75***    & 10.41***    \\
		& (0.02)	&	(0.04)       & (0.02)      & (0.03)      & (0.03)      & (0.02)      & (0.04)                   \\
		\midrule
		R-Squared & .82    & 0.853     & 0.789      & 0.843     & 0.783      & 0.833     & 0.785     \\
		Observations & 8210 & 2053      & 6157       & 4105      & 4105       & 6158      & 2052      \\ \bottomrule
	\end{tabular*}
	\captionof*{table}{Standard errors in parentheses
		
		* p < 0.05, ** p < 0.01, *** p < 0.001}
	\label{fullRegTable}
		\end{minipage}
	\end{sideways}
\end{center}

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
Warlord02145
Posts: 2
Joined: Fri Mar 17, 2023 9:25 pm

Configuring a Table and Section Header

Postby Warlord02145 » Fri Mar 17, 2023 11:54 pm

So it seems like setting this up is far more complicated then I imagined. Thanks for the reply!

Bartman
Posts: 332
Joined: Fri Jan 03, 2020 2:39 pm

Configuring a Table and Section Header

Postby Bartman » Sat Mar 18, 2023 1:16 am

Please try to offer a complete Infominimal working example.

Apparently the \linewidth length has to be replaced by the \textheight command because of the tabular* environment.

\documentclass{article}
\usepackage{rotating}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{showframe}

\begin{document}
\section{Results}
\vfill
\begin{center}
	\begin{sideways}
	\begin{minipage}{.95\textheight}% \linewidth substituted
    \centering
	\captionof{table}{Regression Table}
    \label{fullRegTable}
	\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}*8l@{}}
		\toprule
		& Complete & \multicolumn{2}{c}{25th Percentile} & \multicolumn{2}{c}{50th Percentile} & \multicolumn{2}{c}{75th Percentile} \\
		\cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8}
		& Dataset & Under 25th   & Over 25th & Under 50th & Over 50th & Under 75th & Over 75th   \\
		\midrule
		VET    &   .5257***    & 1.011*      & .4971***    & .3728       & .5856***    & .2243       & .5976***    \\
		&	(0.07)	&	(0.50)       & (0.08)      & (0.27)      & (0.10)      & (0.17)      & (0.14)                   \\
		POP  &   1.5e-07***     & 2.1e-07***  & 5.0e-07***  & 1.7e-07***  & 5.2e-07***  & 1.5e-07***  & 5.1e-07***  \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		WHITE   &   .000377**  & -5.6e-06    & .00099***   & .000159     & .001065***  & .00009      & .00178***   \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		UNIT &  -8.2e-07**      & -1.1e-06*** & -2.6e-06*** & -9.2e-07*** & -2.7e-06*** & -8.1e-07*** & -2.6e-06*** \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		INC  &   4.4e-06***     & 5.7e-06***  & 3.4e-06***  & 5.5e-06***  & 2.2e-06***  & 5.2e-06***  & 1.4e-06***  \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		COST &    .000732***    & .000568***  & .000903***  & .000622***  & .000985***  & .000672***  & .001028***  \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		Constant &  10.69***   & 10.85***    & 10.5***     & 10.79***    & 10.46***    & 10.75***    & 10.41***    \\
		& (0.02)	&	(0.04)       & (0.02)      & (0.03)      & (0.03)      & (0.02)      & (0.04)                   \\
		\midrule
		R-Squared & .82    & 0.853     & 0.789      & 0.843     & 0.783      & 0.833     & 0.785     \\
		Observations & 8210 & 2053      & 6157       & 4105      & 4105       & 6158      & 2052      \\ \bottomrule
	\end{tabular*}\par\bigskip
	Standard errors in parentheses\par
	* p $<$ 0.05, ** p $<$ 0.01, *** p $<$ 0.001
	\end{minipage}
	\end{sideways}
\end{center}
\end{document}

JustineRosa
Posts: 1
Joined: Thu Apr 06, 2023 9:41 am

Configuring a Table and Section Header

Postby JustineRosa » Fri Apr 14, 2023 7:33 am

Bartman wrote:Please try to offer a complete Infominimal working example.

Apparently the \linewidth length has to be replaced by the \textheight command because of the tabular* environment.

\documentclass{article}
\usepackage{rotating}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{showframe}

\begin{document}
\section{Results}
\vfill
\begin{center}
	\begin{sideways}
	\begin{minipage}{.95\textheight}% \linewidth substituted
    \centering
	\captionof{table}{Regression Table}
    \label{fullRegTable}
	\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}*8l@{}}
		\toprule
		& Complete & \multicolumn{2}{c}{25th Percentile} & \multicolumn{2}{c}{50th Percentile} & \multicolumn{2}{c}{75th Percentile} \\
		\cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8}
		& Dataset & Under 25th   & Over 25th & Under 50th & Over 50th & Under 75th & Over 75th   \\
		\midrule
		VET    &   .5257***    & 1.011*      & .4971***    & .3728       & .5856***    & .2243       & .5976***    \\
		&	(0.07)	&	(0.50)       & (0.08)      & (0.27)      & (0.10)      & (0.17)      & (0.14)                   \\
		POP  &   1.5e-07***     & 2.1e-07***  & 5.0e-07***  & 1.7e-07***  & 5.2e-07***  & 1.5e-07***  & 5.1e-07***  \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		WHITE   &   .000377**  & -5.6e-06    & .00099***   & .000159     & .001065***  & .00009      & .00178***   \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		UNIT &  -8.2e-07**      & -1.1e-06*** & -2.6e-06*** & -9.2e-07*** & -2.7e-06*** & -8.1e-07*** & -2.6e-06*** \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		INC  &   4.4e-06***     & 5.7e-06***  & 3.4e-06***  & 5.5e-06***  & 2.2e-06***  & 5.2e-06***  & 1.4e-06***  \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		COST &    .000732***    & .000568***  & .000903***  & .000622***  & .000985***  & .000672***  & .001028***  \\
		&	(0.00)	&	(0.00)       & (0.00)      & (0.00)      & (0.00)      & (0.00)      & (0.00)                   \\
		Constant &  10.69***   & 10.85***    & 10.5***     & 10.79***    & 10.46***    & 10.75***    & 10.41***    \\
		& (0.02)	&	(0.04)       & (0.02)      & (0.03)      & (0.03)      & (0.02)      & (0.04)                   \\
		\midrule
		R-Squared & .82    & 0.853     & 0.789      & 0.843     & 0.783      & 0.833     & 0.785     \\
		Observations & 8210 & 2053      & 6157       & 4105      & 4105       & 6158      & 2052      \\ \bottomrule
	\end{tabular*}\par\bigskip
	Standard errors in parentheses\par
	* p $<$ 0.05, ** p $<$ 0.01, *** p $<$ 0.001
	\end{minipage}
	\end{sideways}
\end{center}
\end{document}






Thank you, you made my day. I was looking for the minimal working example and I am glad I found your post. If I want to know more, I will message you and If you need to write an essay on classification but don't know how to do it and don't worry you can go to this web-site here you can see full guide to how to write an essay. which helps you to complete your essay easily. I also use is this website to get a guide to how to write an essay.




Thank you, you made my day. I was looking for the minimal working example and I am glad I found your post. If I want to know more, I will message you.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 13 guests