Is it possible to have a hook in every display math mode, before and after the formula?

For example: if I would like to make every display formula 50% smaller, I would ask the hook on entering the $$ formula to be \scalebox{.5}\bgroup\ensuremath\bgroup and the one on leaving the formula would be \egroup\egroup.

It should work both with $$...$$, \[...\] and with \begin{equation}...\end{equation}.

In other words, writing

$$ x^2+y^2=1 $$

should be equivalent to


Is this possible?

  • 1
    possibly it's possible but that would also have other bad effects eg making it inline math not display math, a more robust alternative would be to specify smaller math fonts with (for example) \DeclareMathSizes rather than use scaling – David Carlisle Oct 12 '16 at 21:57
  • 1
    See tex.stackexchange.com/a/5152/36296 – user36296 Oct 12 '16 at 21:59
  • Well in fact what I want to do is a \resizebox{\textwidth}{!}{...} whenever the formula is larger than \textwidth – yannis Oct 12 '16 at 22:02
  • 1
    @yannis that's so evil but if it has to be done.... – David Carlisle Oct 12 '16 at 22:04

enter image description here

may the gods of math typesetting forgive me.








\z{\cos\theta - \frac{t^5}{s^4}+\sqrt{x^2-y^2}+a+b}

\z{\cos\theta +\sin\phi + \tan\sigma - \frac{t^5}{s^4}+\sqrt{x^2-y^2}+a+b}

  • 2
    No, they won't. :P – egreg Oct 12 '16 at 22:46
  • 1
    @egreg that's what I fear – David Carlisle Oct 12 '16 at 22:59
  • Great, thanks!! Don't worry about the gods, this is for private use only, no book carrying the trace of your sin will ever be published (except perhaps the next edition of the Necronomicon, but this even the gods cannot read without going insane). – yannis Oct 13 '16 at 9:56

There already exists the nccmath package, which defines ‘medium-maths’ commands and environments you might be interested in: they scale to ~ 80 % of \displaystyle.

Here is an example:


\[ a^2 + b^2 = 1,\quad \int_a^b \frac{f(x)}{g(x)}\,\mathrm d\mkern1mu x, \quad\begin{bmatrix}x & y\\u & v\end{bmatrix}\]%

\[ \medmath{ a^2 + b^2 = 1}, \quad \medint\int_a^b \mfrac{f(x)}{g(x)}\,\mathrm d\mkern1mu x \quad\left[\begin{mmatrix}x & y\\u & v\end{mmatrix}\right] \]%


enter image description here

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.