2

Hopefully this isn't a duplicate post, I was not able to find the appropriate answer at least. As I am still new to Latex I did a lot of reading here to create my table in bootab style with a descriptive column first (line break, due to long text) and 5 numerical columns for categories.

Problem is, that though I thought to have defined the alignment, the numerical columns don't seem to do as ordered ^^ Maybe it's due to the X column type, but i couldn't figure out how to fix it, so far. Also I violated the rule of not using multicol, because I need headers for my categories. The picture shows the results, which are decent I think, but still display this strange alignment of the columns. Would it be easier to just align all columns, except the first, the same way (including the multicols) ?

enter image description here

\documentclass[ twoside,openright,titlepage,fleqn,numbers=noenddot,headinclude
            12pt,a4paper]{scrreprt}
\usepackage{amsmath,amsthm}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{endnotes}
\usepackage{lscape}
\usepackage{verbatim}
\usepackage[utf8]{inputenc}   
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}  
\usepackage{microtype}        
\usepackage{marvosym}      
\usepackage{lmodern}
\usepackage{caption}
\usepackage{array,booktabs,tabularx}
\usepackage{multicol}

\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}
    \pagestyle{empty}

\begin{table} 
    \begin{spacing}{1.0}
\caption[Tabelle 3.1]
        {"Ubersicht wichtiger Kennzahlen der identischen, indirekt absetzenden Gartenbauhaupterwerbsbetriebe (10 Jahre) mit Spezialisierung Zierpflanzenbau}
\label{Tabelle 3.1}
    \begin{tabularx}{\linewidth}{        % {\hsize}{p{0.1666666\textwidth}*{6}{L}} wenn alle gleich sein sollen
    >{\raggedright\arraybackslash\hsize=2\hsize}X
    >{\raggedleft\arraybackslash\hsize=0.8\hsize}X
    >{\raggedleft\arraybackslash\hsize=0.8\hsize}X
    >{\raggedleft\arraybackslash\hsize=0.8\hsize}X
    >{\raggedleft\arraybackslash\hsize=0.8\hsize}X
    >{\raggedleft\arraybackslash\hsize=0.8\hsize}X
       % 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}{690}&\multicolumn{1}{c}{335}&\multicolumn{1}{c}{314}&\multicolumn{1}{c}{12}&\multicolumn{1}{c}{39} \\
     \midrule
Betriebsfl"ache [ha]&     3,42&     6,20&     2,64&     2,84&     3,91\\
FALSCH [m\textsuperscript{2}/AK]& 1.846& 1.502& 2.083&   644&   243\\
Hochglas beheizbar [m\textsuperscript{2}]&11.405& 9.043& 6.778& 9.607& 2.138\\
Hochglas nicht-beheizbar [m\textsuperscript{2}]&   840&   334&   356&    66& 1.448\\
Freiland Zierpflanzen [m\textsuperscript{2}]&14.113&47.706&11.886& 2.500&18.664\\
     \textbf{Kapitalstruktur} \\
Anteil Fremdkapital am Verm"ogen [\%]&    54,19&    42,29&    37,16&    60,00&    33,88\\
Anteil Fremdkapital am Anlageverm"ogen o. Boden [\%]&   135,94&   178,48&    82,17&    93,33&   214,24\\
Kapital je Arbeitskraft [\EUR{}/AK]&92.555&105.697&99.825&53.828&76.670\\
Maschinen und Fuhrpark je Arbeitskraft [\EUR{}/AK]&19.818&21.273&16.714&10.326& 5.170\\
     \textbf{Arbeitswirtschaft} \\
Arbeitskr"afte insgesamt [AK]&     7,50&     6,99&     3,75&    16,72&    17,89\\
Anteil Fremd-Arbeitskr"afte an den AK [\%]&    65,82&    67,55&    39,05&    86,92&    88,74\\
Nettoinvestitionen je Arbeitskraft [\EUR{}/AK]& 1.081& 2.460&-1.430&-2.669&   744\\
     \textbf{Erfolgsgr"o"sen} \\
Gewinn je Familien-AK [\EUR{}/AK]                        &87.673&96.301&36.737&19.645&65.362\\
Anteil Reinertrag am BE [\%]&    -2,65&     7,76&    -5,81&    -5,28&     1,62\\
Bereinigter BE pro EQM [\EUR{}/EQM]&     2,74&     2,29&     1,80&     4,78&     8,72\\
    \bottomrule
\end{tabularx}
    \end{spacing}
    \end{table}
    \end{document}
2
  • 1
    If problem is with Anzahl Betriebe row, you could use \multicolumn{1}{r}{690}. But if the problem is aligning integers and decimals, you could look a siunitx S columns.
    – Ignasi
    Commented Sep 9, 2016 at 9:31
  • thanks! this solved the problem with my alignment. i didn't know of the siunitx package :) Commented Sep 19, 2016 at 14:00

2 Answers 2

2

You really never want to use X columns for numeric data (which means you hardly ever want to use tabularx for numeric data) X columns are all about adjusting line breaking within the column and here you only ever want linebreaking in the first column so that should be the only column using X, then for the numeric alignment use a column type designed for that, either S column from siunitx or D column from dcolumn pacakges. I used S here as you have a mixture of , and . which is harder to handle with dcolumn.

enter image description here

\documentclass[ twoside,openright,titlepage,fleqn,numbers=noenddot,headinclude
            12pt,a4paper]{scrreprt}
\usepackage{amsmath,amsthm}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{endnotes}
\usepackage{lscape}
\usepackage{verbatim}
\usepackage[utf8]{inputenc}   
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}  
\usepackage{microtype}        
\usepackage{marvosym}      
\usepackage{lmodern}
\usepackage{caption}
\usepackage{array,booktabs,tabularx}
\usepackage{multicol}

\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

%\usepackage{dcolumn}\newcolumntype{d}{D,,{3.3}}

\usepackage{siunitx}\newcolumntype{d}{S}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \begin{document}
    \pagestyle{empty}

\begin{table} 
    \begin{spacing}{1.0}
\caption[Tabelle 3.1]
        {"Ubersicht wichtiger Kennzahlen der identischen, indirekt absetzenden Gartenbauhaupterwerbsbetriebe (10 Jahre) mit Spezialisierung Zierpflanzenbau}
\label{Tabelle 3.1}
    \begin{tabularx}{\linewidth}{        % {\hsize}{p{0.1666666\textwidth}*{6}{L}} wenn alle gleich sein sollen
    >{\raggedright\arraybackslash}X
    *{5}{d}
       % 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}{690}&\multicolumn{1}{c}{335}&\multicolumn{1}{c}{314}&\multicolumn{1}{c}{12}&\multicolumn{1}{c}{39} \\
     \midrule
Betriebsfl"ache [ha]&     3,42&     6,20&     2,64&     2,84&     3,91\\
FALSCH [m\textsuperscript{2}/AK]& 1.846& 1.502& 2.083&   644&   243\\
Hochglas beheizbar [m\textsuperscript{2}]&11.405& 9.043& 6.778& 9.607& 2.138\\
Hochglas nicht-beheizbar [m\textsuperscript{2}]&   840&   334&   356&    66& 1.448\\
Freiland Zierpflanzen [m\textsuperscript{2}]&14.113&47.706&11.886& 2.500&18.664\\
     \textbf{Kapitalstruktur} \\
Anteil Fremdkapital am Verm"ogen [\%]&    54,19&    42,29&    37,16&    60,00&    33,88\\
Anteil Fremdkapital am Anlageverm"ogen o. Boden [\%]&   135,94&   178,48&    82,17&    93,33&   214,24\\
Kapital je Arbeitskraft [\EUR{}/AK]&92.555&105.697&99.825&53.828&76.670\\
Maschinen und Fuhrpark je Arbeitskraft [\EUR{}/AK]&19.818&21.273&16.714&10.326& 5.170\\
     \textbf{Arbeitswirtschaft} \\
Arbeitskr"afte insgesamt [AK]&     7,50&     6,99&     3,75&    16,72&    17,89\\
Anteil Fremd-Arbeitskr"afte an den AK [\%]&    65,82&    67,55&    39,05&    86,92&    88,74\\
Nettoinvestitionen je Arbeitskraft [\EUR{}/AK]& 1.081& 2.460&-1.430&-2.669&   744\\
     \textbf{Erfolgsgr"o"sen} \\
Gewinn je Familien-AK [\EUR{}/AK]                        &87.673&96.301&36.737&19.645&65.362\\
Anteil Reinertrag am BE [\%]&    -2,65&     7,76&    -5,81&    -5,28&     1,62\\
Bereinigter BE pro EQM [\EUR{}/EQM]&     2,74&     2,29&     1,80&     4,78&     8,72\\
    \bottomrule
\end{tabularx}
    \end{spacing}
    \end{table}
    \end{document}
0
2

I'm not sure if it's better than yours, but this can be done with siunitx

enter image description here

\documentclass[ twoside,openright,titlepage,fleqn,numbers=noenddot,headinclude
            12pt,a4paper]{scrreprt}
\usepackage{amsmath,amsthm}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{endnotes}
\usepackage{lscape}
\usepackage{verbatim}
\usepackage[utf8]{inputenc}   
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}  
\usepackage{microtype}        
\usepackage{marvosym}      
\usepackage{lmodern}
\usepackage{caption}
\usepackage{array,booktabs,tabularx}
\usepackage{multicol}
\usepackage{siunitx}

\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}
    \pagestyle{empty}

\begin{table} 
    \begin{spacing}{1.0}
\caption[Tabelle 3.1]
        {"Ubersicht wichtiger Kennzahlen der identischen, indirekt absetzenden Gartenbauhaupterwerbsbetriebe (10 Jahre) mit Spezialisierung Zierpflanzenbau}
\label{Tabelle 3.1}
    \sisetup{table-number-alignment=center,
        table-figures-decimal = 2,
        output-decimal-marker={,},
        group-separator={.},
        group-minimum-digits=4} 
    \begin{tabular}{p{.25\textwidth}SSSSS}     
    \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}&690&335&314&12&39\\
     \midrule
Betriebsfl"ache [ha]&     3,42&     6,20&     2,64&     2,84&     3,91\\
FALSCH [m\textsuperscript{2}/AK]& 1846& 1502& 2083&   644&   243\\
Hochglas beheizbar [m\textsuperscript{2}]&11405& 9043& 6778& 9607& 2138\\
Hochglas nicht-beheizbar [m\textsuperscript{2}]&   840&   334&   356&    66& 1.448\\
Freiland Zierpflanzen [m\textsuperscript{2}]&14113&47706&11886& 2500&18664\\
     \textbf{Kapitalstruktur} \\
Anteil Fremdkapital am Verm"ogen [\%]&    54,19&    42,29&    37,16&    60,00&    33,88\\
Anteil Fremdkapital am Anlageverm"ogen o. Boden [\%]&   135,94&   178,48&    82,17&    93,33&   214,24\\
Kapital je Arbeitskraft [\EUR{}/AK]&92555&105697&99825&53828&76670\\
Maschinen und Fuhrpark je Arbeitskraft [\EUR{}/AK]&19818&21273&16714&10326& 5170\\
     \textbf{Arbeitswirtschaft} \\
Arbeitskr"afte insgesamt [AK]&     7,50&     6,99&     3,75&    16,72&    17,89\\
Anteil Fremd-Arbeitskr"afte an den AK [\%]&    65,82&    67,55&    39,05&    86,92&    88,74\\
Nettoinvestitionen je Arbeitskraft [\EUR{}/AK]& 1081& 2460&-1430&-2669&   744\\
     \textbf{Erfolgsgr"o"sen} \\
Gewinn je Familien-AK [\EUR{}/AK]                        &87673&96301&36737&19645&65362\\
Anteil Reinertrag am BE [\%]&    -2,65&     7,76&    -5,81&    -5,28&     1,62\\
Bereinigter BE pro EQM [\EUR{}/EQM]&     2,74&     2,29&     1,80&     4,78&     8,72\\
    \bottomrule
\end{tabular}
    \end{spacing}
    \end{table}
    \end{document}
1
  • thanks! this solved the problem with my alignment. i didn't know of the siunitx package :) Commented Sep 19, 2016 at 14:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .