Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

We need to make clear that certain data is the same in several rows. An underbrace taken from math-mode does the job quite well, but is unfortunately way too prominent in the table, especially in contrast to booktab’s layout.

Table with underbrace

\documentclass{article}


\usepackage{tabularx}
\usepackage{booktabs}


\begin{document}
\begin{tabular}{lccc} 
\toprule
& XXX & YYY & ZZZ \\
\midrule
 aaa & 11111111111111 & 222222222222 & 333333333333 \\
 bbb & 11111111111111 & 222222222222 & 333333333333 \\
 ccc & 11111111111111 & 222222222222 & 333333333333 \\
 & \multicolumn{3}{c}{{$\underbrace {\hspace{22em}}$}} \\
\\
 ddd & & 0000 \\
\bottomrule 
\end{tabular}


\end{document}

I've tried \resizebox to shrink the brace, but this looks what it is: squeezed. It is also possible to use tikz to make something close to curly braces, but I am not too happy with the result of either; I'd like to retain the drawn, "swashy" quality of the math-mode.

Is there a possibility to get slimmer braces (i.e. like drawn with a narrower nib) in the same design as used in math-mode?

share|improve this question
2  
And by "slimmer" you're referring to a thinner horizontal rule that connects the end points and middle cusp? –  Werner Nov 26 '12 at 21:12
    
Yes, sorry, that wasn't clear -- edited above, hope it is now... –  Florian Nov 26 '12 at 22:33
add comment

3 Answers 3

up vote 3 down vote accepted

You can use a smaller font, also you can use a stretch version rather than having to specify the width:

enter image description here

\documentclass{article}


\usepackage{tabularx}
\usepackage{booktabs}


\begin{document}
\font\smallex=cmex10 at 4pt
\begin{tabular}{lccc} 
\toprule
& XXX & YYY & ZZZ \\
\midrule
 aaa & 11111111111111 & 222222222222 & 333333333333 \\
 bbb & 11111111111111 & 222222222222 & 333333333333 \\
 ccc & 11111111111111 & 222222222222 & 333333333333 \\
 & \multicolumn{3}{c}{{$\underbrace {\hspace{22em}}$}} \\
 cc22c & 11111111111111 & 222222222222 & 333333333333 \\
& \multicolumn{3}{c}{\textfont3=\smallex\upbracefill} \\
 ddd & & 0000 \\
\bottomrule 
\end{tabular}


\end{document}
share|improve this answer
    
I’d upvote this twice if I could! The stretch saves us a lot of work, indeed... –  Florian Nov 27 '12 at 11:42
add comment

Does this look good to you?

\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}

\newcommand\tikzmark[1]{%
  \tikz[remember picture,overlay,inner xsep=0pt]\node (#1) {};}

\begin{document}
\begin{tabular}{lccc} 
\toprule
& XXX & YYY & ZZZ \\
\midrule
 aaa & 11111111111111 & 222222222222 & 333333333333 \\
 bbb & 11111111111111 & 222222222222 & 333333333333 \\
 ccc & \tikzmark{start}11111111111111 & 222222222222 & 333333333333\tikzmark{end} \\[2pt]
 ddd & & \\
\bottomrule 
\end{tabular}
\tikz[remember picture,overlay]{
  \draw[decorate,decoration={brace,mirror,raise=2pt}] (start) --node[below=3pt] {0000} (end);
}

\end{document}

enter image description here

Using the line width key you can control the thickness; for example, you can use:

\tikz[remember picture,overlay]{
  \draw[line width=0.2pt,decorate,decoration={brace,mirror,raise=2pt}] (start) --node[below=3pt] {0000} (end);
}
share|improve this answer
    
Thanks for that! But isn't the result the same as the tikz-solution linked in the question? I'd really like to have the "swashy" quality of the mathematical braces, but I'll probably use your plain-line variant, if nobody can show an easy way for the other one. –  Florian Nov 26 '12 at 22:21
    
@Florian it's quite similar (although my code is considerably shorter) to the one in the last post, but the shape of the brace is not exactly the same. –  Gonzalo Medina Nov 26 '12 at 22:35
    
I hadn't noticed the shape-difference at first, thanks for clarifing. I will will use David Carlisle’s solution for this project, but yours goes to my snippet collection for another time. –  Florian Nov 27 '12 at 11:39
add comment

Without tikz:

\documentclass{article}


\usepackage{tabularx}
\usepackage{booktabs,xcolor}


\begin{document}
\begin{tabular}{lccc}
\toprule
& XXX & YYY & ZZZ \\
\midrule
 aaa & 11111111111111 & 222222222222 & 333333333333 \\
 bbb & 11111111111111 & 222222222222 & 333333333333 \\
 ccc & 11111111111111 & 222222222222 & 333333333333 \\[-1.2em]
 & \multicolumn{3}{c}{\color{gray!70}{{$\underbrace {\hspace{22em}}$}}} \\[-.2em]
 ddd &\multicolumn{3}{c}{0000} \\
\bottomrule
\end{tabular}


\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.