4

What I'm looking for is a way to use \big and its friends such that they adapt to the environment that they're in, e.g. \scriptstyle. To a degree, this was already covered in this question and the corresponding answer, but the results are not yet as I'd hope.

\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}

\newcommand{\tbo}{\tilde{b}+1}

\begin{document}

\[ \left(\tbo\right)^{\left(\tbo\right)^{\left(\tbo\right)}} \]
\vspace{-0.5cm}
\[ \bigl(\tbo\bigr)^{\bigl(\tbo\bigr)^{\bigl(\tbo\bigr)}} \]

% Bruno Le Floch's modification (see answer linked above)
\makeatletter
\let\bBigg@@\bBigg@
\renewcommand{\bBigg@}[2]{{%
  \mathchoice
    {\bBigg@@{#1}{#2}}%
    {\bBigg@@{#1}{#2}}%
    {\big@size=.7\big@size\bBigg@@{#1}{#2}}%
    {\big@size=.5\big@size\bBigg@@{#1}{#2}}}}%
\makeatother

\vspace{-0.5cm}
\[ \bigl(\tbo\bigr)^{\bigl(\tbo\bigr)^{\bigl(\tbo\bigr)}} \]

\end{document}

big

The modification improves the sizing a bit, but not substantially (especially in the \scriptscriptstyle). Also, the horizontal spacing in the small styles is a bit wide for my taste. I tried playing around with the factors 0.7 and 0.5 a bit, but this didn't change anything (to the bare eye).

I don't know if it's too much to ask, but I'd hope that it's possible to mimic the behaviour of \big for normal text as closely as possible also for the superscripts.

In a perfect world, a solution would also take into account what David Carlisle's comment to the answer linked above mentioned, namely preventing the scaling to be too small for smaller font sizes. However, I don't know how to read NFSS data, and neither whether this could be done dynamically...

| improve this question | | | | |
  • 2
    I'm not sure whether bigger delimiters are good in such a case. To be honest, I'm sure they aren't. – egreg Dec 17 '13 at 12:02
  • I tend to agre with @egreg . If anything, I would consider putting the largest one in \bigl(...\bigr) to make it a bit larger since it has a large exponent, but that depends a lot on the context, too. – yo' Dec 17 '13 at 12:17
  • @egreg: Well, the example here is contrived for demonstration purposes, but I have use cases where standard brackets are too small, left/right is too big, and \big would be fine if it behaved as in normal mode. Or do you mean "using \big in sub/superscripts is not good" in general? – Axel Dec 17 '13 at 12:45
  • @Axel Stacking complicated exponents is usually not recommended, because it hinders readability. – egreg Dec 17 '13 at 12:48
  • I agree with @egreg, there is no reason to scale the fences here. It is fully clear what they fence in, and there is no need for them to vertically cover the tilde. – daleif Dec 17 '13 at 13:10
2

Here's an alternative: the \scaleleftright macro of the scalerel package. It will scale the 1st and third argument to the vertical extent of the second argument (without the requirement imposed by \left \right of centering about the math axis).

To respond to the criticism of tohecz and a query by the OP, one can compensate for the unbalanced math axis by adding a "strut" that conforms to the font size AND obeys the math axis. Here, I show a result demonstrating the point of tohecz, first without such a strut, and then with a strut. The strut is a \vphantom of a left paren in the current math size, scaled to 130% size (that size can be changed if what needs to be enclosed is of larger/smaller vertical extent). The paren is symmetric about the math axis, and so therefore is \mstrut. The size of the paren in the current math style is imported to the \scalebox by using the \ThisStyle{...\SavedStyle...} construct of scalerel.

\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{scalerel}

\newcommand{\tbo}{\tilde{b}+1}

\begin{document}

\[ \scaleleftright{(}{\tbo}{)}^{{\scaleleftright{(}{a_j - 1}{)}}%
  ^{\scaleleftright{(}{\tbo}{)}}}
\]

\renewcommand{\tbo}{\tilde{b}+1\mstrut}
\newcommand\mstrut{\ThisStyle{\vphantom{\scalebox{1.3}{$\SavedStyle($}}}}

\[ \scaleleftright{(}{\tbo}{)}^{{\scaleleftright{(}{a_j - 1\mstrut}{)}}%
  ^{\scaleleftright{(}{\tbo}{)}}}
\]

\end{document}

enter image description here

| improve this answer | | | | |
  • $\scaleleftright{(}{\tilde b+1}{)}\scaleleftright{(}{a_j-1}{)}$ will very likely give a very confusing result. There is a good reason why math axis exists, it's not something Knuth implemented while being on LSD. – yo' Dec 17 '13 at 12:21
  • @tohecz I understand the argument of math axes, and don't disagree with you. Nonetheless, there arise situations where breaking the rules can occasionally make sense. Perhaps this is one. – Steven B. Segletes Dec 17 '13 at 12:53
  • @StevenB.Segletes, thanks for the response; visually it is pretty muched what I imagined, but it still has the problem (feature?) of adjusting to the height of the content (which may not always be desired). In terms of the math axis, is there a way to expand away from it in both directions equally (sort of like the inverse of \smash), such that one doesn't have to manually adjust the struts for different content? Or even better, a version of the macro which respects the math axis? – Axel Dec 17 '13 at 13:26
  • @Axel The problem with the default way it is done is that, when in sub-sub-script mode, things like 1ex do not shrink accordingly, nor do things like \strut. The way to remedy that is to define a "strut" that is based on the current math size, as I have done in tohecz-inspired update. While I chose that strut somewhat arbitrarily, based on what was being typeset, one could choose a strut that obeys the math axis AND scales with the font size, such as \newcommand\mstrut{\ThisStyle{\vphantom{\scalebox{1.1}{$\SavedStyle($}}}}. Perhpas I'll update my answer. – Steven B. Segletes Dec 17 '13 at 14:42
  • @StevenB.Segletes, thanks again for your answer. It's not exactly what I had in mind, but I'll try it out and have accepted your answer. – Axel Dec 18 '13 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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