von Bartman » So 21. Jun 2020, 15:22
@Tim133
Meine Änderung des Beispiels des Stammgastes lässt in einer Spalte den Spaltentyp S des Pakets siunitx mit dem Spaltentyp X zusammenarbeiten, um eine alternative Anordnung der Zahlen zu zeigen.
Der mathematische Modus wird in keiner Spalte gebraucht und sorgt in der letzten Spalte, wie zu erwarten, für einen Abstand nach dem Komma.
\documentclass[
fontsize=12pt,
oneside,
bibliography=totoc,
captions=tableabove,
% parskip=off,
appendixprefix=true,
chapterprefix=false,
numbers=noenddot,
ngerman
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{booktabs,tabularx}% Meine Änderung kommt ohne multirow aus.
\usepackage[svgnames,table]{xcolor}
\usepackage{lmodern}
\usepackage{eurosym}
\usepackage{microtype}
\usepackage[locale=DE]{siunitx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Werkzeugstandmengen und -kosten}
\label{tab:standmenge}
\begin{tabularx}{\textwidth}{
lC
S[table-format=3]
CC
}
\toprule
Technologie & Standlänge &
\multicolumn{1}{>{\centering}X}{Nachschliffint.} &% oder
% \multicolumn{1}{C}{Nachschliffint.} &
Gesamtstückzahl & Werkzeugkosten \\
& mm & {Stk.} & Stk. & \euro/Stk. \\
\midrule
\rowcolor[gray]{0.7}kon. deg. Z14& 3325 & 133 & 4389 & 1,50 \\
\rowcolor[gray]{0.7}kon. deg. Z13& 3075 & 123 & 4059 & 1,62 \\
\rowcolor[gray]{0.7}kon. deg. Z12& 2850 & 114 & 3762 & 1,75 \\
kon. deg. Z11& 2600& 104& 3432&1,92\\
\rowcolor[gray]{0.7}kon. deg. Z10& 2375& 95 &3135&2,10 \\
kon. deg. Z09& 2125& 85 &2805&2,35 \\
kon. deg. Z08& 1900& 76 &2508&2,63 \\
\rowcolor[gray]{0.7}
zyl. deg. Z14 & 3325 & 133 & 6650 & 1,32 \\
\rowcolor[gray]{0.7}
zyl. deg. Z13 & 3075 & 123 & 6150 & 1,43 \\
\rowcolor[gray]{0.7}
zyl. deg. Z12 & 2850 & 114 & 5700 & 1,54 \\
\rowcolor[gray]{0.7}
zyl. deg. Z11 & 2600 & 104 & 5200 & 1,69 \\
\rowcolor[gray]{0.7}
zyl. deg. Z10 & 2375 & 95 & 4750 & 1,85 \\
\rowcolor[gray]{0.7}
zyl. deg. Z09 & 2125 & 85 & 4250 & 2,07 \\
\rowcolor[gray]{0.7}
zyl. deg. Z08 & 1900 & 76 & 3800 & 2,32 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
Eine Variante mit \rowcolors:
\documentclass[
fontsize=12pt,
oneside,
bibliography=totoc,
captions=tableabove,
% parskip=off,
appendixprefix=true,
chapterprefix=false,
numbers=noenddot,
ngerman
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{booktabs,tabularx}% Meine Änderung kommt ohne multirow aus.
\usepackage[svgnames,table]{xcolor}
\usepackage{lmodern}
\usepackage{eurosym}
\usepackage{microtype}
\usepackage[locale=DE]{siunitx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
% https://tex.stackexchange.com/questions/297345
\newcounter{tblerows}
\expandafter\let\csname c@tblerows\endcsname\rownum
\begin{document}
\begin{table}[htbp]
\centering
\caption{Werkzeugstandmengen und -kosten}
\label{tab:standmenge}
\rowcolors{3}{gray!70}{gray!70}
\begin{tabularx}{\textwidth}{
lC
S[table-format=3]
CC
}
\toprule
Technologie & Standlänge &
\multicolumn{1}{>{\centering}X}{Nachschliffint.} &% oder
% \multicolumn{1}{C}{Nachschliffint.} &
Gesamtstückzahl & Werkzeugkosten \\
& mm & {Stk.} & Stk. & \euro/Stk. \\
\midrule
kon. deg. Z14 & 3325 & 133 & 4389 & 1,50 \\
kon. deg. Z13 & 3075 & 123 & 4059 & 1,62 \\
kon. deg. Z12 & 2850 & 114 & 3762 & 1,75 \\
\hiderowcolors
kon. deg. Z11 & 2600 & 104 & 3432 & 1,92\\
\showrowcolors
kon. deg. Z10 & 2375 & 95 & 3135 & 2,10 \\
\hiderowcolors
kon. deg. Z09 & 2125 & 85 & 2805 & 2,35 \\
kon. deg. Z08 & 1900 & 76 & 2508 & 2,63 \\
\showrowcolors
zyl. deg. Z14 & 3325 & 133 & 6650 & 1,32 \\
zyl. deg. Z13 & 3075 & 123 & 6150 & 1,43 \\
zyl. deg. Z12 & 2850 & 114 & 5700 & 1,54 \\
zyl. deg. Z11 & 2600 & 104 & 5200 & 1,69 \\
zyl. deg. Z10 & 2375 & 95 & 4750 & 1,85 \\
zyl. deg. Z09 & 2125 & 85 & 4250 & 2,07 \\
zyl. deg. Z08 & 1900 & 76 & 3800 & 2,32 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
[mention]Tim133[/mention]
Meine Änderung des Beispiels des Stammgastes lässt in einer Spalte den Spaltentyp [tt]S[/tt] des Pakets [CTAN]siunitx[/CTAN] mit dem Spaltentyp [tt]X[/tt] zusammenarbeiten, um eine alternative Anordnung der Zahlen zu zeigen.
Der mathematische Modus wird in keiner Spalte gebraucht und sorgt in der letzten Spalte, wie zu erwarten, für einen Abstand nach dem Komma.
[code]\documentclass[
fontsize=12pt,
oneside,
bibliography=totoc,
captions=tableabove,
% parskip=off,
appendixprefix=true,
chapterprefix=false,
numbers=noenddot,
ngerman
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{booktabs,tabularx}% Meine Änderung kommt ohne multirow aus.
\usepackage[svgnames,table]{xcolor}
\usepackage{lmodern}
\usepackage{eurosym}
\usepackage{microtype}
\usepackage[locale=DE]{siunitx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Werkzeugstandmengen und -kosten}
\label{tab:standmenge}
\begin{tabularx}{\textwidth}{
lC
S[table-format=3]
CC
}
\toprule
Technologie & Standlänge &
\multicolumn{1}{>{\centering}X}{Nachschliffint.} &% oder
% \multicolumn{1}{C}{Nachschliffint.} &
Gesamtstückzahl & Werkzeugkosten \\
& mm & {Stk.} & Stk. & \euro/Stk. \\
\midrule
\rowcolor[gray]{0.7}kon. deg. Z14& 3325 & 133 & 4389 & 1,50 \\
\rowcolor[gray]{0.7}kon. deg. Z13& 3075 & 123 & 4059 & 1,62 \\
\rowcolor[gray]{0.7}kon. deg. Z12& 2850 & 114 & 3762 & 1,75 \\
kon. deg. Z11& 2600& 104& 3432&1,92\\
\rowcolor[gray]{0.7}kon. deg. Z10& 2375& 95 &3135&2,10 \\
kon. deg. Z09& 2125& 85 &2805&2,35 \\
kon. deg. Z08& 1900& 76 &2508&2,63 \\
\rowcolor[gray]{0.7}
zyl. deg. Z14 & 3325 & 133 & 6650 & 1,32 \\
\rowcolor[gray]{0.7}
zyl. deg. Z13 & 3075 & 123 & 6150 & 1,43 \\
\rowcolor[gray]{0.7}
zyl. deg. Z12 & 2850 & 114 & 5700 & 1,54 \\
\rowcolor[gray]{0.7}
zyl. deg. Z11 & 2600 & 104 & 5200 & 1,69 \\
\rowcolor[gray]{0.7}
zyl. deg. Z10 & 2375 & 95 & 4750 & 1,85 \\
\rowcolor[gray]{0.7}
zyl. deg. Z09 & 2125 & 85 & 4250 & 2,07 \\
\rowcolor[gray]{0.7}
zyl. deg. Z08 & 1900 & 76 & 3800 & 2,32 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}[/code]
Eine Variante mit [tt]\rowcolors[/tt]:
[code]\documentclass[
fontsize=12pt,
oneside,
bibliography=totoc,
captions=tableabove,
% parskip=off,
appendixprefix=true,
chapterprefix=false,
numbers=noenddot,
ngerman
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{booktabs,tabularx}% Meine Änderung kommt ohne multirow aus.
\usepackage[svgnames,table]{xcolor}
\usepackage{lmodern}
\usepackage{eurosym}
\usepackage{microtype}
\usepackage[locale=DE]{siunitx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
% https://tex.stackexchange.com/questions/297345
\newcounter{tblerows}
\expandafter\let\csname c@tblerows\endcsname\rownum
\begin{document}
\begin{table}[htbp]
\centering
\caption{Werkzeugstandmengen und -kosten}
\label{tab:standmenge}
\rowcolors{3}{gray!70}{gray!70}
\begin{tabularx}{\textwidth}{
lC
S[table-format=3]
CC
}
\toprule
Technologie & Standlänge &
\multicolumn{1}{>{\centering}X}{Nachschliffint.} &% oder
% \multicolumn{1}{C}{Nachschliffint.} &
Gesamtstückzahl & Werkzeugkosten \\
& mm & {Stk.} & Stk. & \euro/Stk. \\
\midrule
kon. deg. Z14 & 3325 & 133 & 4389 & 1,50 \\
kon. deg. Z13 & 3075 & 123 & 4059 & 1,62 \\
kon. deg. Z12 & 2850 & 114 & 3762 & 1,75 \\
\hiderowcolors
kon. deg. Z11 & 2600 & 104 & 3432 & 1,92\\
\showrowcolors
kon. deg. Z10 & 2375 & 95 & 3135 & 2,10 \\
\hiderowcolors
kon. deg. Z09 & 2125 & 85 & 2805 & 2,35 \\
kon. deg. Z08 & 1900 & 76 & 2508 & 2,63 \\
\showrowcolors
zyl. deg. Z14 & 3325 & 133 & 6650 & 1,32 \\
zyl. deg. Z13 & 3075 & 123 & 6150 & 1,43 \\
zyl. deg. Z12 & 2850 & 114 & 5700 & 1,54 \\
zyl. deg. Z11 & 2600 & 104 & 5200 & 1,69 \\
zyl. deg. Z10 & 2375 & 95 & 4750 & 1,85 \\
zyl. deg. Z09 & 2125 & 85 & 4250 & 2,07 \\
zyl. deg. Z08 & 1900 & 76 & 3800 & 2,32 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}[/code]