Since I'm writing a document with thousands of brackets of all kinds, manually sizing all the brackets or manually add \mleft
and \mright
every time will be need a lot of time in the end. Moreover, I don't have strict typographic rules to follow since the document is for private use.
So in this case it is not a bad idea to redefine (
and )
as \mleft(
and \mright)
respectively, and the same also for square and curly brackets (obviously in math mode only).
I'm aware about all the drawbacks about the use of auto resizing brackets (for example Spacing around \left and \right or Why doesn't LaTeX interpret ( as \left( and ) as \right)? or Is it ever bad to use \left and \right?), at least using \mleft
and \right
the spacing problem is solved.
In the page How to make \{ and \} automatically have \left and \right egreg explains that there is an easy way to achieve the goal in the case of curly brackets. The macro consists in adding \left
and \right
in the definitions of \{
and \}
that are found in latex.ltx
file.
\documentclass{article}
\usepackage{amsmath}
\usepackage{mleftright}
\let\{\relax \let\}\relax % to avoid warnings about the redefinition
\DeclareRobustCommand{\{}{\ifmmode\mleft\lbrace\else\textbraceleft\fi}
\DeclareRobustCommand{\}}{\ifmmode\mright\rbrace\else\textbraceright\fi}
\begin{document}
$a\{\dfrac13\}a$
\end{document}
I'm looking for a similar way to redefine the commands of curved and square brackets, but I don't know how to find their definitions in the file latex.ltx
since it is a very big file.
fontmath.ltx
.\DeclarePairedDelimiter, and its variants, command from
mathtools`.\{
redefinition will break any existing use of\left\{x\right\}
which occurs in multiple packages, if not in your document, there are really only downsides to this.nath
package does it by default, butnath
display math clashes withamsmath
, so it doesn't tend to be used much.