How to render a double bottom border on a single table cell?
Typically one could use hhline
to modify the horizontal rule within a tabular
, allowing a mixture of single and double lines. However, the output in your case is not very desirable. Here's an alternative, showing a modified version of your input (using booktabs
) first with \hhline
and then without (and some other tricks):
\documentclass{article}
\usepackage{booktabs,hhline}% http://ctan.org/pkg/{booktabs,hhline}
\begin{document}
\begin{tabular}{lrr}
\toprule
Item & Sales & Total \\
\midrule
Item 1 & 10 & \\
Item 1 & 10 & 20 \\ \hhline{--=}
Item 1 & 10 & \\
Item 2 & 10 & \\
Item 2 & 10 & 30 \\ \hhline{--=}
\end{tabular}
\bigskip
\begin{tabular}{lrr}
\toprule
Item & Sales & Total \\
\midrule
Item 1 & 10 & \\
Item 1 & 10 & 20 \\ \hline \\[\dimexpr-\normalbaselineskip+\arrayrulewidth+1pt]
\cline{3-3}
Item 1 & 10 & \\
Item 2 & 10 & \\
Item 2 & 10 & 30 \\ \hline \\[\dimexpr-\normalbaselineskip+\arrayrulewidth+1pt]
\cline{3-3}
\end{tabular}
\end{document}
The second option inserts a regular \hline
followed by a 1pt
gap and \cline{3-3}
(modify 1pt
for a different gap). More specifically, \dimexpr
allows for an expression of dimensions, jumping back (vertically upward) a full baseline skip (-\normalbaselineskip
) and then forward (vertically downward) the default width of the rule (\arrayrulewidth
, typically 0.4pt
) plus 1pt
.
I'm sure another technique would also suffice; this just seemed the most straight forward. This is mainly based on style, so there are other options as well.
The later option needs some additional hacking when using vertical borders also,
\documentclass{article}
\begin{document}
\begin{tabular}{|l|r|r|}
Item & Sales & Total \\
Item 1 & 10 & \\
Item 1 & 10 & 20 \\ \hline
& & \\[\dimexpr-\normalbaselineskip+\arrayrulewidth+1pt] \cline{3-3}
Item 1 & 10 & \\
Item 2 & 10 & \\
Item 2 & 10 & 30 \\ \hline
\multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{}
\\[\dimexpr-\normalbaselineskip+\arrayrulewidth+1pt] \cline{3-3}
\end{tabular}
\end{document}
hhline
is designed to make such partial lines easy to produce:
\documentclass{article}
\usepackage{hhline}
\begin{document}
\begin{table}[htbp]
\begin{tabular}{|l|r|r|}
\hline
Item & Sales & Total \\ \hline
Item 1 & 10 & \\ \hline
Item 1 & 10 & 20 \\ \hhline{|-|-|=|}
Item 1 & 10 & \\ \hline
Item 2 & 10 & \\ \hline
Item 2 & 10 & 30 \\ \hhline{|-|-|=|}
\end{tabular}
\end{table}
\end{document}