longtable: Spalten gleichmäßig verteilen

Antwort erstellen


Diese Frage dient dazu, das automatisierte Versenden von Formularen durch Spam-Bots zu verhindern.
Smilies
:D :) :( :o :shock: :? 8) :lol: :-x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:

BBCode ist eingeschaltet
[img] ist eingeschaltet
[flash] ist ausgeschaltet
[url] ist eingeschaltet
Smilies sind eingeschaltet

Die letzten Beiträge des Themas

Ich habe die Datenschutzerklärung gelesen und bin damit einverstanden.

   

Wenn du eine Datei oder mehrere Dateien anhängen möchtest, gib die Details unten ein.

Ansicht erweitern Die letzten Beiträge des Themas: longtable: Spalten gleichmäßig verteilen

Problem gelöst

von likelihood » Do 14. Mär 2013, 15:09

Vielen Dank noch einmal.

Das Problem wurde wie folgt gelöst:
\documentclass{article}

 \usepackage{lscape}

 \usepackage{longtable}
 \usepackage[singlelinecheck=off]{caption}

\def\flushright{\trivlist \raggedleft\item\relax}
\def\endflushleft{\endtrivlist}

 \begin{document}

 \begin{landscape}

\centering 
\small 

 \setlength{\LTpost}{0pt} 

 \begin{longtable}{lccccccc}

 \hline
                                           &   \multicolumn{7}{c}{Income}                                       \\
 Regressors                        &   (1)         &   (2)         &   (3)         &   (4)         &   (5)         &   (6)         &   (7)         \\
 \hline
 \endfirsthead
 \multicolumn{8}{c}{\textit{Continued from previous page}}                                                            \\
 \hline
                                           &   \multicolumn{7}{c}{Income}                                       \\
 Regressors                        &   (1)         &   (2)         &   (3)         &   (4)         &   (5)         &   (6)         &   (7)         \\
 \hline
 \endhead
 \multicolumn{8}{c}{\textit{Continued on next page}}                                                                  \\
 \endfoot
 \endlastfoot
 Employment*Year                     &   -0.15      &   -0.15      &   -0.17      &   -0.12      &   -0.18      &   -0.21*      &   -0.04      \\
                               &   (0.10)      &   (0.12)      &   (0.19)      &   (0.14)      &   (0.13)      &   (0.13)      &   (0.15)      \\
 Employment*Month                  &   -0.04      &   -0.00      &   -0.14      &   -0.13      &   0.07      &   -0.16      &   0.21      \\
                               &   (0.30)      &   (0.34)      &   (0.54)      &   (0.43)      &   (0.40)      &   (0.41)      &   (0.37)      \\
 \hline
 Number of Observations               &   110,301      &   85,829      &   24,472      &   50,285      &   60,016      &   83,894      &   26,407      \\
 Number of Individuals               &   13,136      &   10,956      &   2,180      &   6,345      &   6,791      &   10,001      &   3,135      \\
 R2                              &   0.03      &   0.04      &   0.03      &   0.03      &   0.04      &   0.04      &   0.03      \\
 Adjusted R2                        &   0.03      &   0.03      &   0.03      &   0.03      &   0.04      &   0.04      &   0.03      \\
 \hline
 \hline
  \end{longtable}
 
\begingroup\setlength\topsep{0pt}


(1) Full Sample, (2) Old-Age Sub-Sample, (3) Young-Age Sub-Sample, (4) Female Sub-Sample, (5) Male Sub-Sample,\\
(6) High-Income Sub-Sample, (7) Low-Income Sub-Sample \\
\textit{Standard errors in parantheses} \\
\textit{*** p\textless0.01, ** p\textless0.05, * p\textless0.1}        \\[\baselineskip]            

\endgroup

\begin{flushleft}                
\textit{Note:} All regression equations include the demographic and human capital characteristics, as well as economic conditions and household characteristics of parents as controls. Moreover, they include the regressors of interest. All figures are rounded to two decimal places.                             \\
\textit{Source:} Own calculations

\end{flushleft}

 \end{landscape}

 \end{document}

Alternative

von likelihood » Mo 11. Mär 2013, 20:10

Liebe Ulrike,

ich habe den Code aus dem Link, den du geposted hast, einmal eingebaut. Leider tut sich da nichts. Das Problem besteht immer noch.

Der Code ist jetzt wie folgt:
\documentclass{article}

 \usepackage{lscape}

 \usepackage{longtable}
 \usepackage[singlelinecheck=off]{caption}

 \begin{document}

 \begin{landscape}
 
 \setlength\LTcapwidth{\textwidth}
 \setlength\LTleft{0pt}
 \setlength\LTright{0pt}

 \begin{center}

 {\small \begin{longtable}{@{\extracolsep{\fill}}|*{15}{lccccccc}}
 
 \hline
                                           &   \multicolumn{7}{c}{Income}                                       \\
 Regressors                        &   (1)         &   (2)         &   (3)         &   (4)         &   (5)         &   (6)         &   (7)         \\
 \hline
 \endfirsthead
 \multicolumn{8}{c}{\textit{Continued from previous page}}                                                            \\
 \hline
                                           &   \multicolumn{7}{c}{Income}                                       \\
 Regressors                        &   (1)         &   (2)         &   (3)         &   (4)         &   (5)         &   (6)         &   (7)         \\
 \hline
 \endhead
 \multicolumn{8}{c}{\textit{Continued on next page}}                                                                  \\
 \endfoot
 \endlastfoot
 Employment*Year                     &   -0.15      &   -0.15      &   -0.17      &   -0.12      &   -0.18      &   -0.21*      &   -0.04      \\
                               &   (0.10)      &   (0.12)      &   (0.19)      &   (0.14)      &   (0.13)      &   (0.13)      &   (0.15)      \\
 Employment*Month                  &   -0.04      &   -0.00      &   -0.14      &   -0.13      &   0.07      &   -0.16      &   0.21      \\
                               &   (0.30)      &   (0.34)      &   (0.54)      &   (0.43)      &   (0.40)      &   (0.41)      &   (0.37)      \\
 \hline
 Number of Observations               &   110,301      &   85,829      &   24,472      &   50,285      &   60,016      &   83,894      &   26,407      \\
 Number of Individuals               &   13,136      &   10,956      &   2,180      &   6,345      &   6,791      &   10,001      &   3,135      \\
 R2                              &   0.03      &   0.04      &   0.03      &   0.03      &   0.04      &   0.04      &   0.03      \\
 Adjusted R2                        &   0.03      &   0.03      &   0.03      &   0.03      &   0.04      &   0.04      &   0.03      \\
 \hline
 \hline
 \multicolumn{8}{c}{(1) Full Sample, (2) Old-Age Sub-Sample, (3) Young-Age Sub-Sample, (4) Female Sub-Sample, (5) Male Sub-Sample}      \\
 \multicolumn{8}{c}{(6) High-Income Sub-Sample, (7) Low-Income Sub-Sample}                                                \\
 \multicolumn{8}{c}{\textit{Standard errors in parantheses}}                                                            \\
 \multicolumn{8}{c}{\textit{*** p\textless0.01, ** p\textless0.05, * p\textless0.1}}                                          \\
 \multicolumn{8}{l}{}                                                                                       \\ 
\multicolumn{8}{p{\linewidth}}{\textit{Note:} All regression equations include the demographic and human capital characteristics, as well as economic conditions and household characteristics of parents as controls. Moreover, they include the regressors of interest. All figures are rounded to two decimal places.}                              \\
 \multicolumn{8}{l}{\textit{Source:} Own calculations}                                                   \\

 \end{longtable}}

 \end{center}

 \end{landscape}

 \end{document}

Ich muss allerdings auch zugeben, dass ich die Note aus Mangel an Wissen über Alternativen direkt in die Tabelle schreibe.

Wenn ich nach "latex longtable caption below" googele, finde ich viele Ergebnisse, die mit table und threeparttable arbeiten, aber nichts Direkts zu longtable. Wie würde man das denn professionell mit Tabellenunterschriften machen, wenn man diese nicht direkt in die Tabelle schreibt?

Viele Grüße aus Berlin,

Chris

von u_fischer » Mo 11. Mär 2013, 18:56

Nun, ich finde übertriebene Spaltenabstände nicht schön. Und ich würde den Note-Teil sowieso außerhalb der Tabelle setzen .


Abgesehen davon
http://tex.stackexchange.com/questions/ ... 4304#54304

Einfügen: Leere Spalte

von likelihood » Mo 11. Mär 2013, 18:49

Liebe Ulrike,

durch das Einfügen einer weiteren leeren Spalte und
\multicolumn{9}{p{\linewidth}}{} \\

ändert sich der Code in:
\documentclass{article}

 \usepackage{lscape}

 \usepackage{longtable}
 \usepackage[singlelinecheck=off]{caption}

 \begin{document}

 \begin{landscape}

 \begin{center}

 {\small \begin{longtable}{lcccccccc}

 \hline
                                           &   \multicolumn{8}{c}{Income}																							\\
 Regressors                        &   (1)         &   (2)         &   (3)         &   (4)         &   (5)         &   (6)         &   (7)  &      					\\
 \hline
 \endfirsthead
 \multicolumn{9}{c}{\textit{Continued from previous page}}																											\\
 \hline
                                           &   \multicolumn{8}{c}{Income}																							\\
 Regressors                        &   (1)         &   (2)         &   (3)         &   (4)         &   (5)         &   (6)         &   (7)	&      					\\
 \hline
 \endhead
 \multicolumn{9}{c}{\textit{Continued on next page}}																												\\
 \endfoot
 \endlastfoot
 Employment*Year                     &   -0.15      &   -0.15      &   -0.17      &   -0.12      &   -0.18      &   -0.21*      &   -0.04	& 	   					\\
                               &   (0.10)      &   (0.12)      &   (0.19)      &   (0.14)      &   (0.13)      &   (0.13)      &   (0.15)	& 	   					\\
 Employment*Month                  &   -0.04      &   -0.00      &   -0.14      &   -0.13      &   0.07      &   -0.16      & 		  0.21	& 	   					\\
                               &   (0.30)      &   (0.34)      &   (0.54)      &   (0.43)      &   (0.40)      &   (0.41)      &   (0.37) 	& 	   					\\
 \hline
 Number of Observations               &   110,301      &   85,829      &   24,472      &   50,285      &   60,016      &   83,894      &   26,407  & 	   			\\
 Number of Individuals               &   13,136      &   10,956      &   2,180      &   6,345      &   6,791      &   10,001      &   3,135   & 	   				\\
 R2                              &   0.03      &   0.04      &   0.03      &   0.03      &   0.04      &   0.04      &   0.03  & 	   								\\
 Adjusted R2                        &   0.03      &   0.03      &   0.03      &   0.03      &   0.04      &   0.04      &   0.03  & 	   							\\
 \hline
 \hline
 \multicolumn{9}{c}{(1) Full Sample, (2) Old-Age Sub-Sample, (3) Young-Age Sub-Sample, (4) Female Sub-Sample, (5) Male Sub-Sample}									\\
 \multicolumn{9}{c}{(6) High-Income Sub-Sample, (7) Low-Income Sub-Sample}																							\\
 \multicolumn{9}{c}{\textit{Standard errors in parantheses}}																										\\
 \multicolumn{9}{c}{\textit{*** p\textless0.01, ** p\textless0.05, * p\textless0.1}}																				\\
 \multicolumn{9}{l}{}																																				\\ 
\multicolumn{9}{p{\linewidth}}{\textit{Note:} All regression equations include the demographic and human capital characteristics, as well as economic conditions and household characteristics of parents as controls. Moreover, they include the regressors of interest. All figures are rounded to two decimal places.}												\\
 \multicolumn{9}{l}{\textit{Source:} Own calculations}																												\\
 \multicolumn{9}{p{\linewidth}}{}																																	\\

 \end{longtable}}

 \end{center}

 \end{landscape}

 \end{document}

Damit löst sich tatsächlich das Problem. Alle acht Originalspalten haben jetzt den gleichen Abstand voneinander. Allerdings ist ein riesiger Abstand zwischen der neunten Spalte (der neu hinzugefügten Spalte) und dem rechten Seitenrand entstanden.

Es wäre gut, wenn die Spalten über die longtable gleich verteilt wären.
Weißt du, wie man das macht?

Liebe Grüße,

Chris

Auskommentieren

von likelihood » Mo 11. Mär 2013, 18:14

Lieber Epllus,

das Auskommentieren der Zeile
%\multicolumn{8}{l}{} \\

hat leider keinen Effekt.

Danke trotzdem,

Chris

von u_fischer » Mo 11. Mär 2013, 14:13

Du kannst eine (leere) 9 Spalte einführen und \multicolumn{9}{\linewidth} benutzen.

von Epllus » Mo 11. Mär 2013, 13:54

So vielleicht?
\documentclass{article} 

\usepackage{lscape} 

\usepackage{longtable} 
\usepackage[singlelinecheck=off]{caption} 

\begin{document} 

\begin{landscape} 

\begin{center} 

{\small \begin{longtable}{lccccccc} 

\hline 
                                          &   \multicolumn{7}{c}{Income}                                       \\ 
Regressors                        &   (1)         &   (2)         &   (3)         &   (4)         &   (5)         &   (6)         &   (7)         \\ 
\hline 
\endfirsthead 
\multicolumn{8}{c}{\textit{Continued from previous page}}                                                            \\ 
\hline 
                                          &   \multicolumn{7}{c}{Income}                                       \\ 
Regressors                        &   (1)         &   (2)         &   (3)         &   (4)         &   (5)         &   (6)         &   (7)         \\ 
\hline 
\endhead 
\multicolumn{8}{c}{\textit{Continued on next page}}                                                                  \\ 
\endfoot 
\endlastfoot 
Employment*Year                     &   -0.15      &   -0.15      &   -0.17      &   -0.12      &   -0.18      &   -0.21*      &   -0.04      \\ 
                              &   (0.10)      &   (0.12)      &   (0.19)      &   (0.14)      &   (0.13)      &   (0.13)      &   (0.15)      \\ 
Employment*Month                  &   -0.04      &   -0.00      &   -0.14      &   -0.13      &   0.07      &   -0.16      &   0.21      \\ 
                              &   (0.30)      &   (0.34)      &   (0.54)      &   (0.43)      &   (0.40)      &   (0.41)      &   (0.37)      \\ 
\hline 
Number of Observations               &   110,301      &   85,829      &   24,472      &   50,285      &   60,016      &   83,894      &   26,407      \\ 
Number of Individuals               &   13,136      &   10,956      &   2,180      &   6,345      &   6,791      &   10,001      &   3,135      \\ 
R2                              &   0.03      &   0.04      &   0.03      &   0.03      &   0.04      &   0.04      &   0.03      \\ 
Adjusted R2                        &   0.03      &   0.03      &   0.03      &   0.03      &   0.04      &   0.04      &   0.03      \\ 
\hline 
\hline 
\multicolumn{8}{c}{(1) Full Sample, (2) Old-Age Sub-Sample, (3) Young-Age Sub-Sample, (4) Female Sub-Sample, (5) Male Sub-Sample}      \\ 
\multicolumn{8}{c}{(6) High-Income Sub-Sample, (7) Low-Income Sub-Sample}                                                \\ 
\multicolumn{8}{c}{\textit{Standard errors in parantheses}}                                                            \\ 
\multicolumn{8}{c}{\textit{*** p\textless0.01, ** p\textless0.05, * p\textless0.1}}                                          \\ 
%\multicolumn{8}{l}{}                                                                                       \\ 
\multicolumn{8}{p{\linewidth}}{\textit{Note:} All regression equations include the demographic and human capital characteristics, as well as economic conditions and household characteristics of parents as controls. Moreover, they include the regressors of interest. All figures are rounded to two decimal places.}                              \\ 
\multicolumn{8}{l}{\textit{Source:} Own calculations}                                                   \\ 

\end{longtable}} 

\end{center} 

\end{landscape} 

\end{document} 

Hoffe es hilft
Epllus

Anders formulieren?

von likelihood » Mo 11. Mär 2013, 13:45

Hi zusammen,

ich habe noch gar keine Antwort auf meine Frage erhalten, oder wenigstens einen Kommentar, und so frage ich mich, ob ich mich vielleicht schlecht ausgedrückt habe und die Frage umformulieren sollte.

Wird nicht klar, was das Problem ist?

Leider kann ich keinen Anhang hinzufügen (Screenshot). Die Funktion hat bei mir noch nie funktioniert.

Viele Grüße,

Chris

longtable: Spalten gleichmäßig verteilen

von likelihood » Mi 6. Mär 2013, 16:12

Hi zusammen,

bisher wurden die Spalten in meinen longtables immer automatisch gleichmäßig verteilt. Leider geschieht dies in der folgenden longtable aus mir unerklärlichen Gründen nicht:
\documentclass{article}

\usepackage{lscape}

\usepackage{longtable}
\usepackage[singlelinecheck=off]{caption}

\begin{document}

\begin{landscape}

\begin{center}

{\small \begin{longtable}{lccccccc}

\hline
														&	\multicolumn{7}{c}{Income}													\\
Regressors								&	(1)			&	(2)			&	(3)			&	(4)			&	(5)			&	(6)			&	(7)			\\
\hline
\endfirsthead
\multicolumn{8}{c}{\textit{Continued from previous page}}																				\\
\hline
														&	\multicolumn{7}{c}{Income}													\\
Regressors								&	(1)			&	(2)			&	(3)			&	(4)			&	(5)			&	(6)			&	(7)			\\
\hline
\endhead
\multicolumn{8}{c}{\textit{Continued on next page}}																						\\
\endfoot
\endlastfoot
Employment*Year							&	-0.15		&	-0.15		&	-0.17		&	-0.12		&	-0.18		&	-0.21*		&	-0.04		\\
										&	(0.10)		&	(0.12)		&	(0.19)		&	(0.14)		&	(0.13)		&	(0.13)		&	(0.15)		\\
Employment*Month						&	-0.04		&	-0.00		&	-0.14		&	-0.13		&	0.07		&	-0.16		&	0.21		\\
										&	(0.30)		&	(0.34)		&	(0.54)		&	(0.43)		&	(0.40)		&	(0.41)		&	(0.37)		\\
\hline
Number of Observations					&	110,301		&	85,829		&	24,472		&	50,285		&	60,016		&	83,894		&	26,407		\\
Number of Individuals					&	13,136		&	10,956		&	2,180		&	6,345		&	6,791		&	10,001		&	3,135		\\
R2										&	0.03		&	0.04		&	0.03		&	0.03		&	0.04		&	0.04		&	0.03		\\
Adjusted R2								&	0.03		&	0.03		&	0.03		&	0.03		&	0.04		&	0.04		&	0.03		\\
\hline
\hline
\multicolumn{8}{c}{(1) Full Sample, (2) Old-Age Sub-Sample, (3) Young-Age Sub-Sample, (4) Female Sub-Sample, (5) Male Sub-Sample}		\\
\multicolumn{8}{c}{(6) High-Income Sub-Sample, (7) Low-Income Sub-Sample}																\\
\multicolumn{8}{c}{\textit{Standard errors in parantheses}}																				\\
\multicolumn{8}{c}{\textit{*** p\textless0.01, ** p\textless0.05, * p\textless0.1}}														\\
\multicolumn{8}{l}{}																													\\
\multicolumn{8}{p{\linewidth}}{\textit{Note:} All regression equations include the demographic and human capital characteristics, as well as economic conditions and household characteristics of parents as controls. Moreover, they include the regressors of interest. All figures are rounded to two decimal places.}										\\
\multicolumn{8}{l}{\textit{Source:} Own calculations}																	\\

\end{longtable}}

\end{center}

\end{landscape}

\end{document}

Die longtable ist sehr groß und hat 8 Spalten. Zwischen der 7. und der 8. Spalte entsteht eine große "Lücke". Diese behebt sich automatisch, sobald ich die Tabellenunterschrift entferne. Bei anderen longtables von mir entstehen allerdings keine Lücken bei gleicher Tabellenunterschrift.

Kurzum: Ich verstehe nicht, warum diese Lücke gerade hier entsteht.

Vielen Dank für euren Rat!

Chris

PS: Leider funktioniert der Upload für ein mögliches Attachment nicht.

Nach oben