4

Maybe my question is a bit ridiculous but I wonder is there any command inverse to \mathstrut? I think this command would be useful for reducing unwanted size of auto delimiter such as inline \Set{}

\usepackage{braket}

\begin{document}
some text
$\Set{A\in R| A\in Q}$ %a bit bad delimiter 
\end{document}

or in \left \right math formulas.

1 Answers1

6

You can use \smash to hide height and depth of contents. In the context of the \Set command from the braket package you need to apply this to each half of the contents separately. In your particular example you will see no difference (with standard fonts) as the braces are already at their smallest size.

Sample output

\documentclass{article}

\usepackage{braket}

\begin{document}

$\Set{A\in R|A\in Q}$

$\Set{\smash{A\in R}|\smash{A\in Q}}$

$\Set{A\in R^{2}|A\in Q}$

$\Set{\smash{A\in R^{2}}|\smash{A\in Q}}$

\end{document}

In general it is best to avoid auto sizing, cf. Is it ever bad to use \left and \right? . The mathtools package documentation provides a \Set command that can be manually sized, e.g. \Set[\bigg], with an auto sizing variant \Set*. Here is the version I usually use:

Sample output

\documentclass{article}

\usepackage{mathtools}

\newcommand{\with}{\SetSymbol[\delimsize]}
\newcommand{\SetSymbol}[1][]{\nonscript\:#1\vert
  \allowbreak\nonscript\:\mathopen{}}
\DeclarePairedDelimiterX{\Set}[1]{\lbrace}{\rbrace}{#1}

\begin{document}

\( \Set{A\in R \with A\in Q} \)

\( \Set{A\in R^{2} \with A\in Q} \)

\( \Set[\big]{A\in R^{2} \with A\in Q} \)

\( \Set*{A\in R^{2} \with A\in Q} \)

\end{document}

You write \with instead of the | in the braket notation. It has the advantage over braket that if you change your mind later and wish to have the separator as a colon instead of a vertical line, then you just adjust the definition of \with (or of \SetSymbol).

Andrew Swann
  • 95,762
  • is this works for command defined in preamble using \left and \right? e.g. \newcommand[\norm][1]{\left\| #1\right\|} then $\norm{\smash{(A^2)^2}}$? –  Sep 13 '19 at 08:00
  • Yes, but again I would use the mathtools constraction \DeclarePairedDelimiter{\norm}{\lVert}{\rVert} which provides \norm[\big] etc. and the autoscaling \norm*. Autoscaling is really only for drafting of material. – Andrew Swann Sep 13 '19 at 08:11
  • 2
    @C.F.G note for example that your norm definition is wrong if you remove the \left/right part, try removing them at do \norm{-1}, the spacing on the - is wrong. In Andrews version the spacing is correct (mainly because of the use of \lVert and \rVert (in general \| is not the correct symbol to use for norms). – daleif Sep 13 '19 at 08:29