### LaTeX users online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 4 guests

### LaTeX Friends

Sponsored by DANTE e.V.: The German speaking TeX Users Group

## Thinner Braces in Math Mode

### LaTeX Forum: Math & Science

Add tags Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
The \underbrace and \overbrace commands are really useful, but they are ugly. I would like to have thinner braces. Is this possible ?

Here's a compilable example :
Code: Select all  •  Open in online LaTeX editor
\documentclass[12pt,letterpaper]{article}\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage{amsmath}\begin{document}  Test with braces :  \begin{equation}    \underbrace{ABCD}_{\text{this is a test}} + DEFG = \overbrace{HIJK}^{\text{this is a test}}  \end{equation}\end{document}

Cham

Posts: 565
Joined: Sat Apr 2nd, 2011

This is depending on the math font you use and the way the braces are built (see here for example). So if you choose a different math font you'll probably get different braces which you might like better.

An example:
Code: Select all  •  Open in online LaTeX editor
\documentclass[12pt,letterpaper]{article}\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage{amsmath}\usepackage{newtxtext}\usepackage{newtxmath}\begin{document}Test with braces:\begin{equation} \underbrace{ABCD}_{\text{this is a test}} + DEFG = \overbrace{HIJK}^{\text{this is a test}}\end{equation}\end{document}

braces.png (7.82 KiB) Viewed 2688 times

Regards
Last edited by cgnieder on Sun Nov 18th, 2012, edited 2 times in total.
Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen

cgnieder
Site Moderator

Posts: 1907
Joined: Sat Apr 16th, 2011
Location: Germany

The newtxtext and newtxmath packages are giving me a compilation error.

If I keep the same fonts as in my example above, is there a way to modify the underbrace and overbrace commands, so they give a nicer (thinner, slimmer) horizontal brace ?

EDIT : By nicer horizontal braces, I mean that the line thickness should be much smaller. Something graceful, not that heavy thick line we currently have.

Cham

Posts: 565
Joined: Sat Apr 2nd, 2011

You should probably install the newtx package from ctan. Depending on your latex distribution there are different ways to install them.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
hugovdberg

Posts: 133
Joined: Sat Feb 25th, 2012
Location: 's-Hertogenbosch, Netherlands

hugovdberg wrote:You should probably install the newtx package from ctan.

My thoughts exactly. The best way would be updating the TeX distribution by using the corresponding package manager. Installing fonts and fonts packages by hand can be a tedious task.

Regards
Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen

cgnieder
Site Moderator

Posts: 1907
Joined: Sat Apr 16th, 2011
Location: Germany

Ok about the newtx package, but what about the braces without changing the fonts ?

Should I conclude that it's not really possible to change the horizontal brace commands ?
Or that it's too complicated to do, so it's not worth it ?

Cham

Posts: 565
Joined: Sat Apr 2nd, 2011

I think the only other option would be drawing them using TikZ or the like, then you have full control over how your braces look like. But designing them might be a tedious task.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
hugovdberg

Posts: 133
Joined: Sat Feb 25th, 2012
Location: 's-Hertogenbosch, Netherlands

mathtools says about \underbrace and \overbrace:

The standard implementation of the math operators \underbrace and \overbrace in LaTeX has some deficiencies. For example, all lengths used internally are fixed and optimized for 10 pt typesetting. As a direct consequence thereof, using font sizes other than 10 will produce less than optimal results. Another unfortunate feature is the size of the braces. In the example below, notice how the math operator \sum places its limit compared to \underbrace.

The package also tries to fix that. So maybe using mathtools will give already what you want. Note the »mathtools« internally also loads »amsmath«.

Regards
Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen

cgnieder
Site Moderator

Posts: 1907
Joined: Sat Apr 16th, 2011
Location: Germany

I'm already using the mathtools package.

Cham

Posts: 565
Joined: Sat Apr 2nd, 2011

Here is a TikZ solution (that might have some rough edges...) I basically stole from here:

Code: Select all  •  Open in online LaTeX editor
\documentclass[12pt,letterpaper]{article}\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage{mathtools}\usepackage{tikz}\usetikzlibrary{decorations.pathreplacing}\makeatletter\def\underbrace#1{%  \@ifnextchar_{\tikz@@underbrace{#1}}{\tikz@@underbrace{#1}_{}}}\def\tikz@@underbrace#1_#2{%  \tikz[baseline=(a.base)] {\node[inner sep=0] (a) {$$#1$$};  \draw[line cap=round,decorate,decoration={brace,amplitude=5pt}]    (a.south east) -- node[below,inner sep=7pt] {$$\scriptstyle #2$$} (a.south west);}}\def\overbrace#1{%  \@ifnextchar^{\tikz@@overbrace{#1}}{\tikz@@overbrace{#1}^{}}}\def\tikz@@overbrace#1^#2{%  \tikz[baseline=(a.base)] {\node[inner sep=0] (a) {$$#1$$};  \draw[line cap=round,decorate,decoration={brace,amplitude=5pt}]    (a.north west) -- node[pos=.5,above,inner sep=7pt] {$$\scriptstyle #2$$} (a.north east);}}\makeatother\begin{document}Test with braces:\begin{equation} \underbrace{ABCD}_{\text{this is a test}} + DEFG = \overbrace{HIJK}^{\text{this is a test}}\end{equation}\end{document}

Regards
Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen

cgnieder
Site Moderator

Posts: 1907
Joined: Sat Apr 16th, 2011
Location: Germany

Next