3

any suggestions on how I could center the vertical lines in the following table. Cheers, Batu

\begin{table}[!htp]
\begin{center}
\begin{tabular}{|c|c||c||c||c|}
\hline
\multicolumn{ 2}{|c|}{} & Eingestellt & Gemessen & Berechnet \\ \hline \hline
 & \multicolumn{ 1}{c||}{Messpunkt Nr} & $f_{0}$ & $u(i)$ & $i$ \\ \cline{ 1- 1}\cline{ 3- 5}
 & \multicolumn{ 1}{c||}{} & $Hz$ & $mV$ & $mA$ \\ \hline \hline
\multicolumn{ 1}{|c|}{\rotatebox[origin=c]{90}{$f\textless f^{\prime}$}} & 1 & 400 & 41.9 & 4.19 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 2 & 684 & 79.1 & 7.91 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 3 & 968 & 138 & 13.8 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 4 & 1252 & 252 & 25.2 \\ \hline
$f^{\prime}$ & 5 & 1537.4 & 560.74 & 56.074 \\ \hline
\multicolumn{ 1}{|c|}{\rotatebox[origin=c]{90}{$f^{\prime}\textless f\textless f_{0}$}} & 6 & 1574 & 616 & 61,6 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 7 & 1609 & 672 & 67.2 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 8 & 1644 & 725 & 72.5 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 9 & 1679 & 770 & 77 \\ \hline
$f_{0}$ & 10 & 1714 & 793 & 79,3 \\ \hline
\multicolumn{ 1}{|c|}{\rotatebox[origin=c]{90}{$f_{0}\textless f\textless f^{\prime \prime}$}} & 11 & 1754 & 787 & 78,7 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 12 & 1794 & 748 & 74.8 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 13 & 1844 & 671 & 67.1 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 14 & 1894 & 590 & 59 \\ \hline
$f^{\prime \prime}$ & 15 & 1912 & 569.74 & 56.974 \\ \hline
\multicolumn{ 1}{|c|}{\rotatebox[origin=c]{90}{$f^{\prime \prime}\textless f$}} & 16 & 2912 & 155 & 15,5 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 17 & 3912 & 98.2 & 9.82 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 18 & 4912 & 76.9 & 7.69 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 19 & 5912 & 64.2 & 6.42 \\ \hline
\end{tabular}
\end{center}
\label{}
\end{table}
4

In my experience, readers strongly detest having to crane their necks by 90 degrees just to read some rotated material, especially if it's not truly necessary to rotate the material to begin with. Hence, I would dispense with the rotation part. I would also give the table a much more "open" look, by omitting all vertical rules and by using the macros of the booktabs package to replace \hline and \cline.

Another thing that readers tend to appreciate, in terms of the "look" of a table, is if numbers are aligned on their respective decimal markers, rather than simply displaying them centered.

enter image description here

\documentclass{report}
\usepackage[skip=0.25\baselineskip]{caption}
\usepackage[ngerman]{babel}
\usepackage{booktabs,amstext,siunitx}
\sisetup{locale=DE}
\begin{document}

\begin{table}[!htp]
\caption{Zahlen} \label{}
\centering
$\begin{array}{@{} lc S[table-format=4.1]
                      S[table-format=3.2]
                      S[table-format=2.3] @{}}
\toprule
& \text{Messpunkt Nr}
& {\text{Eingestellt}} 
& {\text{Gemessen}} 
& {\text{Berechnet}} \\ 
& & {f_{0}} & {U(I)} & {I} \\ 
& & \si{\hertz} & \si{\milli\volt} & \si{\milli\ampere} \\ 
\midrule
f< f' & 1 &  400 &  41.9 &  4.19 \\ 
      & 2 &  684 &  79.1 &  7.91 \\ 
      & 3 &  968 & 138   & 13.8  \\ 
      & 4 & 1252 & 252   & 25.2  \\ \addlinespace
f' & 5 & 1537.4 & 560.74 & 56.074\\ 
\addlinespace
f'< f< f_{0} & 6 & 1574 & 616 & 61,6 \\ 
 & 7 & 1609 & 672 & 67.2 \\ 
 & 8 & 1644 & 725 & 72.5 \\ 
 & 9 & 1679 & 770 & 77 \\ \addlinespace
f_{0} & 10 & 1714 & 793 & 79,3 \\ \addlinespace
f_{0}<f<f'' & 11 & 1754 & 787 & 78,7 \\ 
 & 12 & 1794 & 748 & 74.8 \\ 
 & 13 & 1844 & 671 & 67.1 \\ 
 & 14 & 1894 & 590 & 59 \\ \addlinespace
f'' & 15 & 1912 & 569.74 & 56.974 \\ \addlinespace
f''< f & 16 & 2912 & 155 & 15,5 \\ 
 & 17 & 3912 & 98.2 & 9.82 \\ 
 & 18 & 4912 & 76.9 & 7.69 \\ 
 & 19 & 5912 & 64.2 & 6.42 \\ 
\bottomrule
\end{array}$
\end{table}
\end{document}
  • thanks for the suggestion. but as i have stated as a comment above, I have no say in how the fromatting should look like. Thanks for the input anyway. best regards – Batuhan Gülcan Dec 2 '17 at 19:57
  • @BatuhanGülcan - It would be quite helpful if you posted such an important piece of information in the query itself rather than as a comment below another answer. – Mico Dec 2 '17 at 20:00
2

The secret is called multirow:

\documentclass[]{article}

\usepackage{rotating}
\usepackage{multirow}

\begin{document}
\begin{table}[!htp]
\begin{center}
\begin{tabular}{|c|c||c||c||c|}
\hline
& Eingestellt & Gemessen & Berechnet \\ \hline \hline
& \multirow{2}{*}{Messpunkt Nr} & $f_{0}$ & $u(i)$ & $i$ \\ \cline{ 1- 1}\cline{ 3- 5}
 & & $Hz$ & $mV$ & $mA$ \\ \hline \hline
 \multirow{4}{*}{\rotatebox[origin=c]{90}{$f\textless f^{\prime}$}} & 1 & 400 & 41.9 & 4.19 \\ \cline{ 2- 5}
& 2 & 684 & 79.1 & 7.91 \\ \cline{ 2- 5}
& 3 & 968 & 138 & 13.8 \\ \cline{ 2- 5}
& 4 & 1252 & 252 & 25.2 \\ \hline
$f^{\prime}$ & 5 & 1537.4 & 560.74 & 56.074 \\ \hline
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f^{\prime}\textless f\textless f_{0}$}} & 6 & 1574 & 616 & 61,6 \\ \cline{ 2- 5}
& 7 & 1609 & 672 & 67.2 \\ \cline{ 2- 5}
& 8 & 1644 & 725 & 72.5 \\ \cline{ 2- 5}
& 9 & 1679 & 770 & 77 \\ \hline
$f_{0}$ & 10 & 1714 & 793 & 79,3 \\ \hline
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f_{0}\textless f\textless f^{\prime \prime}$}} & 11 & 1754 & 787 & 78,7 \\ \cline{ 2- 5}
& 12 & 1794 & 748 & 74.8 \\ \cline{ 2- 5}
& 13 & 1844 & 671 & 67.1 \\ \cline{ 2- 5}
& 14 & 1894 & 590 & 59 \\ \hline
$f^{\prime \prime}$ & 15 & 1912 & 569.74 & 56.974 \\ \hline
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f^{\prime \prime}\textless f$}} & 16 & 2912 & 155 & 15,5 \\ \cline{ 2- 5}
& 17 & 3912 & 98.2 & 9.82 \\ \cline{ 2- 5}
& 18 & 4912 & 76.9 & 7.69 \\ \cline{ 2- 5}
& 19 & 5912 & 64.2 & 6.42 \\ \hline
\end{tabular}
\end{center}
\label{}
\end{table}
\end{document}

enter image description here

But I would typeset the table more like this:

\documentclass[]{article}

\usepackage{rotating}
\usepackage{multirow}
\usepackage{booktabs}

\begin{document}
\begin{table}[!htp]
\begin{center}
\begin{tabular}{ccccc}
  \toprule
& Eingestellt & Gemessen & Berechnet \\ 
& Messpunkt Nr. & $f_{0}$ in Hz & $u(i)$ in mV & $i$ in mA \\ 
\midrule
 \multirow{4}{*}{\rotatebox[origin=c]{90}{$f\textless f^{\prime}$}} & 1 & 400 & 41.9 & 4.19 \\
& 2 & 684 & 79.1 & 7.91 \\
& 3 & 968 & 138 & 13.8 \\
& 4 & 1252 & 252 & 25.2 \\
\midrule
$f^{\prime}$ & 5 & 1537.4 & 560.74 & 56.074 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f^{\prime}\textless f\textless f_{0}$}} & 6 & 1574 & 616 & 61,6 \\
& 7 & 1609 & 672 & 67.2 \\
& 8 & 1644 & 725 & 72.5 \\
& 9 & 1679 & 770 & 77 \\
\midrule
$f_{0}$ & 10 & 1714 & 793 & 79,3 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f_{0}\textless f\textless f^{\prime \prime}$}} & 11 & 1754 & 787 & 78,7 \\
& 12 & 1794 & 748 & 74.8 \\
& 13 & 1844 & 671 & 67.1 \\
& 14 & 1894 & 590 & 59 \\
\midrule
$f^{\prime \prime}$ & 15 & 1912 & 569.74 & 56.974 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f^{\prime \prime}\textless f$}} & 16 & 2912 & 155 & 15,5 \\
& 17 & 3912 & 98.2 & 9.82 \\
& 18 & 4912 & 76.9 & 7.69 \\
& 19 & 5912 & 64.2 & 6.42 \\
\bottomrule
\end{tabular}
\end{center}
\label{}
\end{table}
\end{document}

enter image description here

Last version: Additionally one could use siunitx to align the numbers better. Note that in this version I also removed the \textless commands, as in math mode one should just use > or < (the 'text' in \textless is for text-mode). Also I changed the ^{\prime} stuff to '. Note that I surrounded the >s with braces to reduce the spacing.

\documentclass[]{article}

\usepackage{rotating}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{table}[!htp]
\begin{center}
\begin{tabular}{cS[table-format=2]S[table-format=4.1]S[table-format=3.2]S[table-format=2.3]}
  \toprule
  & {Eingestellt} & {Gemessen} & \multicolumn{2}{c}{Berechnet} \\ 
  & {Messpunkt Nr.} & {$f_{0}$ in Hz} & {$u(i)$ in mV} & {$i$ in mA} \\ 
\midrule
 \multirow{4}{*}{\rotatebox[origin=c]{90}{$f'{>}f$}} & 1 & 400 & 41.9 & 4.19 \\
& 2 & 684 & 79.1 & 7.91 \\
& 3 & 968 & 138 & 13.8 \\
& 4 & 1252 & 252 & 25.2 \\
\midrule
$f'$ & 5 & 1537.4 & 560.74 & 56.074 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f_{0}{>}f{>}f'$}} & 6 & 1574 & 616 & 61,6 \\
& 7 & 1609 & 672 & 67.2 \\
& 8 & 1644 & 725 & 72.5 \\
& 9 & 1679 & 770 & 77 \\
\midrule
$f_{0}$ & 10 & 1714 & 793 & 79,3 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f''{>}f{>}f_{0}$}} & 11 & 1754 & 787 & 78,7 \\
& 12 & 1794 & 748 & 74.8 \\
& 13 & 1844 & 671 & 67.1 \\
& 14 & 1894 & 590 & 59 \\
\midrule
$f''$ & 15 & 1912 & 569.74 & 56.974 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f{>}f''$}} & 16 & 2912 & 155 & 15,5 \\
& 17 & 3912 & 98.2 & 9.82 \\
& 18 & 4912 & 76.9 & 7.69 \\
& 19 & 5912 & 64.2 & 6.42 \\
\bottomrule
\end{tabular}
\end{center}
\label{}
\end{table}
\end{document}

enter image description here

  • great thanks for the fast reply. i have very strict requirements on how the table has to look like. i like how it looks in the second version ut i have to use the first one. thanks again – Batuhan Gülcan Dec 2 '17 at 19:41
  • 1
    @BatuhanGülcan then still you should not use \textless but <. – Skillmon Dec 2 '17 at 19:43
  • Relative to what the OP posted, the words "Eingestellt", "Gemessen" and "Berechnet" seem to have gotten shifted to the left. Is this intentional? – Mico Dec 2 '17 at 19:56
  • @Mico seems like I have made a change too much (at the start when I was trying to clean up all those unnecessary \multicolumns). It was not intentional, thanks for pointing out. I won't edit it though. – Skillmon Dec 2 '17 at 22:23

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.