2

Tabularx + Multicolumn + numeric columns - Alignment how? In a blanc sheet, this worked fine. Now I try to use it with classicthesis and the table won't fit any longer. Do I have to somehow define width of the numeric columns? tabularx calculates a far too small width for the first column, despite gaps on the right side width table set to \linewidth or \hsize, and a far too big when using \paperwidth.

In classicthesis I use these additional configurations for the table:

\usepackage[utf8]{inputenc}   
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}  
\usepackage{microtype}        
\usepackage{caption}
\usepackage{array,booktabs,tabularx}
\usepackage{multicol}
\usepackage[bindingoffset=10mm,left=2.5cm,right=2.5cm,top=1.5cm,bottom=1.5cm,includehead,includefoot]{geometry}

\setlength{\oddsidemargin}{0in}
\setlength{\textwidth}{6.85in}
\setlength{\topmargin}{0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textheight}{9in}
\renewcommand{\baselinestretch}{1.46}
\renewcommand{\arraystretch}{1.3}
\setlength{\evensidemargin}{0in}
\flushbottom

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \begin{document}

Here a reduced Version with simple right alignment of the numeric columns:

\begin{table} 
    \begin{spacing}{1.0}
\caption{"Ubersicht wichtiger Kennzahlen der indirekt absetzenden Gartenbauhaupterwerbsbetriebe mit Spezialisierung Zierpflanzenbau im Datenpool* \label{tab:Gruppen10Jahre}}
    \begin{tabularx}{\linewidth}{        % {\hsize}{p{0.1666666\textwidth}*{6}{L}} wenn alle gleich sein sollen
    >{\raggedright\arraybackslash}X
    *{5}{r}
       % sum=6.0\hsize for 6 columns
 }
    \toprule
                &\multicolumn{2}{c}{Topfpflanzen} &\multicolumn{1}{c}{Schnittblumen}&\multicolumn{1}{c}{Jungpflanzen}&\multicolumn{1}{c}{Stauden} \\
                &\multicolumn{1}{c}{Nicht-Azerca}&\multicolumn{1}{c}{Azerca}&            &             &           \\
    \midrule
\textbf{Anzahl Betriebe**}&\multicolumn{1}{c}{446}&\multicolumn{1}{c}{97}&\multicolumn{1}{c}{125}&\multicolumn{1}{c}{18}&\multicolumn{1}{c}{35} \\
     \midrule


Betriebsfl"ache [ha] &        3,59&        6,82&        3,41&                4,98&        9,64\\


Hochglas beheizbar [m\textsuperscript{2}]&   11.442&    8.790&    6.760&       11.836&    2.370\\


Freiland Zierpflanzen [m\textsuperscript{2}]&   14.019&   51.824&   17.833&      14.894&   41.959\\

     \textbf{Kapitalstruktur} \\
Anteil Fremdkapital am Verm"ogen [\%]&       70,56&       44,92&       48,50&             101,82&       34,22\\


Kapital je Arbeitskraft [\EUR{}/AK]&   86.297&   97.285&   92.166&      71.556&   84.578\\


Maschinen und Fuhrpark je Arbeitskraft [\EUR{}/AK]&   17.369&   17.646&   14.014&      13.766&    9.537\\

     \textbf{Arbeitswirtschaft} \\
Arbeitskr"afte insgesamt [AK]&        8,47&        7,95&        4,03&               15,87&       15,43\\


Anteil Fremd-Arbeitskr"afte an den AK [\%]&       66&       69&       43&             80&       77\\


Arbeitsintensit"at EQM [EQM/AK]&   36.934&   44.958&   49.435&      23.392&   15.680\\


Nettoinvestitionen je Arbeitskraft [\EUR{}/AK]&      431&    1.810&     -593&          2.072&    1.086\\

     \textbf{Erfolgsgr"o"sen} \\
Gewinn je Familien-AK [\EUR{}/AK]&   69.293&   100.602&   30.322&      63.394&   55.459\\


Anteil Reinertrag am BE [\%]&       -2,63&        4,98&       -9,29&              -15,57&       -3,85\\


Bereinigter BE pro EQM [\EUR{}/EQM]&        2,69&        2,23&        1,79&                4,01&        6,58\\

\bottomrule
\multicolumn{6}{l}{\footnotesize *Mittelwerte aller Betriebe, die im Zeitraum 2005 - 2015 am Kennzahlenvergleich teilnahmen.}\\
\multicolumn{6}{l}{\footnotesize **Identische Betriebe wurden einmal gezählt, gehen jedoch aufgrund der Erfassung ggf. für mehrere Jahre ein.}\\
\end{tabularx}
    \end{spacing}
    \end{table} 

Picture of my output, with table settings as before, \linewidth for table.

enter image description here

Using \paperwidth instead, curiosly leads to different calculations of the x column resulting in no linebreak at all: enter image description here

  • 1
    What's the purpose of using geometry and then reset most of the parameters by hand? Moreover, there's no hint at what document class you're using, nor the call to classicthesis. Please, make a self-contained document showing the issue. – egreg Sep 22 '16 at 8:58
  • the images do not relate to the posted code so really do not help at all. – David Carlisle Sep 22 '16 at 9:01
  • Topfpflanze is a pretty wide/long word and it cannot be hyphenated in r columns. You have five of them. The rest of the available width goes to the X-column, but there is almost nothing left. – Johannes_B Sep 22 '16 at 9:09
  • Off-topic: You shouldn't modify the low-level parameter \baselinestretch directly. Instead, load the setspace package and issue the directive \setstretch{1.46} (or whatever factor you prefer). That way, you won't have to use a spacing environment inside a table environment. – Mico Sep 22 '16 at 9:52
1

(edited the code after learning from OP that . ("dot") signifies a thousands-separator)

Some suggestions and observations:

  • By default, the width of the textblock is quite narrow if the classicthesis package has been loaded. Instead of trying to shoehorn the table onto the page in portrait mode, you should consider typesetting it in landscape mode. One way to do this is to load the rotating package and to use a sidewaystable environment instead of the table environment.

  • If you typeset the tabular material in landscape mode and use a tabularx environment and the X column type for the first column, you'll find that the width of the first column is simply excessive. I suggest you use the basic tabular environment and an l column type for the first column.

  • I would also like to suggest that you (a) center the numeric information in columns 2 thru 6 on the decimal markers and (b) use the siunitx package and its S column type to do so; see the code below for a specific implementation.

  • It's probably also a good idea to provide a bit more (vertical) whitespace in the interior of the tabular environment.

  • Finally, I'd like to suggest you use a threeparttable environment so that the caption, the tabular material, and any table notes all occupy the same width.

enter image description here

\documentclass[a4paper,12pt]{scrreprt} % as in some of the OP's earlier queries
\usepackage{classicthesis}
\usepackage[bindingoffset=10mm, hmargin=2.5cm, vmargin=1.5cm,
            includehead, includefoot]{geometry}
\usepackage[utf8]{inputenc}   
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}  
\usepackage{microtype,booktabs,eurosym,rotating}
\usepackage{siunitx}
\sisetup{locale=DE, group-separator={.}, group-minimum-digits=4}
\usepackage[flushleft]{threeparttable}
\renewcommand\TPTtagStyle{\itshape}

\flushbottom
\begin{document}

\begin{sidewaystable} 
\centering
\begin{threeparttable}
\caption{"Ubersicht wichtiger Kennzahlen der indirekt absetzenden Gartenbauhaupterwerbsbetriebe 
mit Spezialisierung Zierpflanzenbau im Datenpool\tnote{a}} 
\label{tab:Gruppen10Jahre}

\begin{tabular}{@{} l *{5}{S[table-format=5.2]} @{}}
\addlinespace
\toprule
&\multicolumn{2}{c}{Topfpflanzen} & {Schnittblumen} & {Jungpflanzen} & {Stauden} \\
\cmidrule(lr){2-3}
& {Nicht-Azerca} & {Azerca} \\
\midrule
\textbf{Anzahl Betriebe}\tnote{b} & 446&97&125&18&35 \\
\addlinespace

Betriebsfl"ache [ha] & 3,59& 6,82& 3,41&  4,98& 9,64\\

Hochglas beheizbar [m\textsuperscript{2}]&   11442&    8790&    6760&       11836&    2370\\

Freiland Zierpflanzen [m\textsuperscript{2}]&   14019&   51824&   17833&      14894&   41959\\

\addlinespace
\textbf{Kapitalstruktur} \\
Anteil Fremdkapital am Verm"ogen [\%]&       70,56&       44,92&       48,50&      101,82&       34,22\\

Kapital je Arbeitskraft [\EUR{}/AK]&   86297&   97285&   92166&      71556&   84578\\

Maschinen und Fuhrpark je Arbeitskraft [\EUR{}/AK]&   17369&   17646&   14014&      13766&    9537\\

\addlinespace
\textbf{Arbeitswirtschaft} \\
Arbeitskr"afte insgesamt [AK]& 8,47& 7,95& 4,03&        15,87&       15,43\\

Anteil Fremd-Arbeitskr"afte an den AK [\%]&66&69&43&80&77\\

Arbeitsintensit"at EQM [EQM/AK]&   36934&   44958&   49435&      23392&   15680\\

Nettoinvestitionen je Arbeitskraft [\EUR{}/AK]& 431& 1810& -593& 2072& 1086\\

\addlinespace
\textbf{Erfolgsgr"o"sen} \\
Gewinn je Familien-AK [\EUR{}/AK]&   69293&   100602&   30322&      63394&   55459\\

Anteil Reinertrag am BE [\%]&       -2,63& 4,98&       -9,29&       -15,57&       -3,85\\

Bereinigter BE pro EQM [\EUR{}/EQM]& 2,69& 2,23& 1,79&  4,01& 6,58\\
\bottomrule
\addlinespace
\end{tabular}

\begin{tablenotes}
\small
\item[a] Mittelwerte aller Betriebe, die im Zeitraum 2005--2015 am Kennzahlenvergleich teilnahmen.
\item[b] Identische Betriebe wurden einmal gezählt, gehen jedoch aufgrund der Erfassung ggf.\ für mehrere Jahre ein.
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}
\end{document}
  • By the way, is "Gartenbauhaupterwerbsbetrieb" a real word? :-) – Mico Sep 22 '16 at 9:40
  • Thank you very much for your help! This certainly is way easier and better. Great ideas also with my footnotes and bold "headlines". One problem however, which I struggle now with, is the correct use of siunitx's local option. The table is already in german format (dot for thousands, and comma for decimals), but siuntix now rounds all thousands and changes dot to comma. PS actually it's a merge of three german words. We are very fond of ridiculous huge nouns ^^ – Sven Neudecker Sep 22 '16 at 11:07
  • @SvenNeudecker - Thanks for enlightening me that . ("dot") signifies a thousands-separator. I'll update the code to reflect this new piece of information. By the way, I think it's really hard to read the table now, with 5- and 6-digit integers being interspersed with 1- and 2-digit numbers with 2 decimals. You may want to think about re-ordering the rows to reduce the haphazard look. – Mico Sep 22 '16 at 11:25
  • @Sven German typography rules would issue \, as the group separation instead of a period. Advantage: Absolutely no confusion about the period being the decimal sign or the phousands separator. Many teachers still do it, because that's the way they did it as long as they know. Time for a change. – Johannes_B Sep 22 '16 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.