1

It is probably one of the easier questions, but I couldn't find a solution yet or think of a good search term for it. I basically want to replicate the last row of this table:

enter image description here

I thought of using multicolumn somehow, but I can't make the columns 1,4 and 5 disappear that way. Maybe multicolumn is also not the way to go and I can just attach two separate cells without a separator to make it look like in the picture.

2

I don't recommend vertical lines in tables, but here is a solution to this problem...

Single cells or a cluster of single cells can be obtained with \multicolumn and \cline in the right manner, of course.

Vanished cells are \multicolumn{number of cells}{l}{}, omitting the | here.

\documentclass{article}


\begin{document}
\huge
\begin{tabular}{|*{8}{l|}}
\hline
This & is & a & bad & example & of & a & table \tabularnewline
\hline
\multicolumn{2}{l|}{} & \multicolumn{1}{c|}{Proved!} & \multicolumn{5}{l}{} \tabularnewline
\cline{3-3} 
\end{tabular}
\end{document}

enter image description here

  • Thanks a lot, somehow I didn't think of leaving multicolumn empty. Why don't you recommend vertical lines, btw? – LatexGuest Sep 4 '15 at 9:51
  • @LatexGuest Just read the documentation to booktabs which will most probably be everything Herr Hupfer would answer to your question. Worth a read, btw. Great package. – LaRiFaRi Sep 4 '15 at 9:56
1

I was much too slow but just in order to show siunitx

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\sisetup{locale=DE,group-separator=.,group-four-digits}
\usepackage{array}

\begin{document}
\begin{tabular}{|S[table-format=2.0]|S[table-format=5.2]|S[table-format=6.2]|S[table-format=5.2]|S[table-format=5.2]|}
    % put the € symbol in your header row as it is redundant.
    \hline
    7 & 28362.47 & 2694.43 & 28362.47 & 0.00 \\\hline
    8 & 28362.47 & 2694.43 & 28362.47 & 0.00 \\\hline
    9 & 28362.47 & 2694.43 & 28362.47 & 0.00 \\\hline
    10 & 28362.47 & 2694.43 & 28362.47 & 0.00 \\\hline
    \multicolumn{1}{l|}{} & \multicolumn{1}{l}{Summe Zinsen:} & \multicolumn{1}{S[table-format=6.2]|}{115569.00} & \multicolumn{2}{l}{} \\
    \cline{2-3}
\end{tabular}
\end{document}

With booktabs:

% arara: pdflatex

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{siunitx}
\sisetup{locale=DE,group-separator=.,group-four-digits}
\usepackage{array}
\usepackage{booktabs}

\begin{document}
\begin{tabular}{S[table-format=2.0]S[table-format=5.2]S[table-format=6.2]S[table-format=5.2]S[table-format=5.2]}
    % put the € symbol in your header row as it is redundant.
    \toprule
        {Number} & {value in €}  & {value in €} & {value in €} & {value in €}\\
    \midrule
    7  & 28362.47 & 2694.43 & 28362.47 & 0.00 \\
    8  & 28362.47 & 2694.43 & 28362.47 & 0.00 \\
    9  & 28362.47 & 2694.43 & 28362.47 & 0.00 \\
    10 & 28362.47 & 2694.43 & 28362.47 & 0.00 \\
    \midrule
    \multicolumn{2}{l}{Summe Zinsen:} & 115569.00 & & \\
    \bottomrule
\end{tabular}
\end{document}

enter image description here

  • 1
    I'll remember that, thanks. I actually generate tables with a little script so far so I don't have to input the numbers or format them with the thousands separators by hand. Very cool solution! – LatexGuest Sep 4 '15 at 9:59
  • @LatexGuest You can even input a mixture of decimal-dot and decimal-comma numbers and it will handle everything right. Great package for sure. – LaRiFaRi Sep 4 '15 at 10:05

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.