2

I managed to align all numbers in a row at the decimal point with this

\documentclass{scrreprt}        
\usepackage{microtype}              
\usepackage[sc]{mathpazo}           
\usepackage{xfrac}                  
\usepackage{booktabs}
\usepackage{tabularx}                   
\usepackage{caption}                
\usepackage{siunitx}                


\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}} 
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}} 
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}} 
\begin{document}   
\begin{table}[h!]    
\setcapmargin*{0.10cm}      
\caption[Übersicht aller PV-Anlagen im Testnetz \textit{Uniwohngebiet}]{Übersicht aller PV-Anlagen im Testnetz \textit{Uniwohngebiet}}  
\small
\centering
\sisetup{output-decimal-marker = {.}}
\begin{tabular}{L{3.5cm} S C{3.5cm} C{2cm} C{2cm}} 
\toprule
\textbf{PV-Einspeisezähler Bezeichnung SWK} & \textbf{Installierte PV-Leistung [$\SI{}{\textbf{kW}}$]} & \textbf{Südausrichtung [°]}  & \textbf{Gruppe} & \textbf{Gemessen}\\ % \textbf{[W]}
\midrule
VNBE014220                  & 3.69  & 16 & 1 & x\\
VNBE014469                  & 11.47 & 16 & 1 & \\
VNBE015412                  & 3.51  & 16 & 1 & x\\    
\bottomrule
\end{tabular}
\label{tab:Uebersicht_PV}
\end{table}
\end{document}

But how can force a line break of the header of the second row?

If i use \begin{tabular}{L{3.5cm} C{3cm} C{3.5cm} C{2cm} C{2cm}} instead of \begin{tabular}{L{3.5cm} S C{3.5cm} C{2cm} C{2cm}} i can make the linebreak with \textbf{Installierte PV-\newline Leistung [$\SI{}{\textbf{kW}}$]}.

Thank you :)

  • 2
    Welcome to TeX.SX! Please post a complete minimal working example (MWE) beginning at \documentclass and ending at \end{document} including all necessary packages and definitions to compile your code and show your issue but not more than that. In your code we do not know how you defined \gls and how the column definition of C and L is. – Skillmon Oct 19 '17 at 8:34
  • Sorry, i edited it – P. Maino Oct 19 '17 at 10:26
  • Your numbers are not aligned at the decimal marker! – Skillmon Oct 19 '17 at 12:37
  • my bad. srry. never wrote something here before. no i've got it! – P. Maino Oct 19 '17 at 12:38
  • 1
    off topic, but if you want to typeset only the units, I would use something like\si[detect-all]{\kilo\watt} instead of \SI{}{\textbf{kW}} – Troy Oct 19 '17 at 12:51
2

You could use the \thead{...} command from the makecell package. Please note that the command has to be enclosed in {} in order to communicate to siunitx that that this cell is not a number.

\documentclass{scrreprt}        
\usepackage{microtype}              
\usepackage[sc]{mathpazo}           
\usepackage{xfrac}                  
\usepackage{booktabs}
\usepackage{tabularx}                   
\usepackage{caption}                
\usepackage{siunitx}  
\usepackage{makecell}        


\renewcommand\theadfont{\bfseries}              

\usepackage{lipsum}

\begin{document}   

\lipsum[2]

\begin{table}[htbp]        
\caption[Übersicht aller PV-Anlagen im Testnetz \textit{Uniwohngebiet}]{Übersicht aller PV-Anlagen im Testnetz \textit{Uniwohngebiet}}
\label{tab:Uebersicht_PV}  
\small
\centering
\sisetup{output-decimal-marker = {.}}
\begin{tabular*}{\textwidth}{@{}l @{\extracolsep{\fill}} S @{\extracolsep{\fill}} c @{\extracolsep{\fill}} c @{\extracolsep{\fill}} c @{}} 
\toprule
{\thead{PV-Einspeisezähler\\ Bezeichnung SWK}} & {\thead{Installierte\\ PV-Leistung [\si[detect-all]{kW}]}} & {\thead{Südausrichtung [°]}}  & {\thead{Gruppe}} & {\thead{Gemessen}}\\ 
\midrule
VNBE014220                  & 3.69  & 16 & 1 & x\\
VNBE014469                  & 11.47 & 16 & 1 & \\
VNBE015412                  & 3.51  & 16 & 1 & x\\    
\bottomrule
\end{tabular*}
\end{table}

\lipsum[2]

\end{document}

enter image description here

  • I was just about to post a makecell answer :( – Skillmon Oct 19 '17 at 12:46
  • @Skillmon Oh, I am sorry! – user36296 Oct 19 '17 at 12:47
  • No problem :) But one should mention, that the surrounding {} in the S-column are important for correct alignment. – Skillmon Oct 19 '17 at 12:47
  • @Skillmon without the {} siunitx will anyway throw an error. – user36296 Oct 19 '17 at 12:48
  • Last question: How do I set the width of every row now? – P. Maino Oct 19 '17 at 13:16

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.