2

We know that \tiny, \scriptsize, etc. are text font macros, and we are notified when using them in math mode:

LaTeX Font Warning: Command \tiny invalid in math mode on input line ...

Nevertheless, as shown by the following MCE, they look like to work, at least in the equation environment (with the downside that the size of the tag's equation is changed as well). Interestingly, they don't work in the equation* environment.

Hence, the commands \tiny, etc. are invalid in math mode, but not so, isn't it?

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
  \tiny%
  e^{i\pi}+1=0
\end{equation}

\begin{equation}
  e^{i\pi}+1=0
\end{equation}

\begin{equation*}
  \tiny%
 e^{i\pi}+1=0
\end{equation*}
\end{document}

enter image description here

Edit

This question arose to myself because a user wants an equation with cases environment to be smaller. In such a case, \scriptstyle and \scriptscriptstyle, which are usually advised in order to use a different (smaller) font inside math mode, don't work as shown by the following MCE (which, BTW, shows how to get normal-sized tags):

\documentclass{article}
\usepackage{kpfonts}
\usepackage{mathtools}
\begin{document}
\begin{equation}
  \tiny%
  \makeatletter
  \renewcommand{\maketag@@@}[1]{\hbox{\m@th\normalsize\normalfont#1}}%
  \makeatother
  \begin{cases}
    e^{i\pi}+1=0
  \end{cases}
  \normalsize
\end{equation}

\begin{equation}
  \scriptstyle%
  \begin{cases}
    e^{i\pi}+1=0
  \end{cases}
\end{equation}

\begin{equation}
  \scriptscriptstyle%
  \begin{cases}
    e^{i\pi}+1=0
  \end{cases}
\end{equation}
\end{document}

enter image description here

7

The math fonts are not set up and LaTeX screams at you:

LaTeX Font Warning: Font shape `OMS/cmsy/m/n' in size <> not available
(Font)              size <5> substituted on input line 7.


LaTeX Font Warning: Font shape `OMS/cmsy/m/n' in size <0.7> not available
(Font)              size <5> substituted on input line 7.

so basically nothing is working but as you chose \tiny and don't really want the subscripts to be impossibly small to read the fact that they are not set up at all and latex does something sort of reasonable as a fallback makes an output that looks plausible, but this is by luck not by design.

5
  • Sorry, my CE was too M: the default math fonts are indeed not set up but, with e.g. kpfonts, no more scream :) In such a case, is it then also by luck? Jun 16 '21 at 11:48
  • Context of my question added in the OP. Jun 16 '21 at 12:15
  • 1
    @DenisBitouzé ah but the new question about \scriptstyle and cases is completely unrelated to the latex fint size question. That is $\scriptstyle x \mbox{$ y $}$ the y is normal sized as the inner math list does not pick up the \scriptstyle setting due to the way that works at the primitive level in Tex. Jun 16 '21 at 12:49
  • 1
    @DenisBitouzé On kp fonts and is it luck, well that depends, it's a deterministic system so nothing is really down to luck. There are cases when a latex size command will work, but mostly there are cases where it will not work (or at least not do what a user expects) so it works if a primitive math display (but not if numbered) it won't work inside a group so x+{\tiny y} it won't work in any sensible way inside an alignment it might not work in the first math expression depending how the math font package set up the initial fonts. ... Jun 16 '21 at 12:56
  • 1
    @DenisBitouzé So Leslie Lamport in the very earliest drafts of latex decided to make it an error rather than document where it might work. Hard to argue that was a bad decision. Jun 16 '21 at 12:56
2

It can be done using boxes, but the offset between the baseline and the center depends on the font size.

\documentclass{article}
\usepackage{kpfonts}
\usepackage{mathtools}
\begin{document}
\begin{equation}
x = \begin{cases} e^{i\pi}+1=0 \\  e^{i\pi}+1=0 \end{cases}
\end{equation}

\begin{equation}
x = \raisebox{0.6pt}{\footnotesize $\displaystyle \begin{cases} e^{i\pi}+1=0 \\  e^{i\pi}+1=0 \end{cases} \frac{1}{2}$}
   \frac{1}{2}
\end{equation}

\end{document}
2
  • Works nicely, but not very handy for documents authors. Jun 16 '21 at 13:34
  • 1
    It turns out that any \hbox will do, not jsut saveboxes. Jun 16 '21 at 14:00
1

unicode-math package's \setmathfont command maps glyphs to names for "every symbol and alphabetic variant" (texdoc unicode-math, p7 (s4)), so that suggests that changing sizes via the single point of the incoming source font itself, by using the underlying fontspec package's Scale= font option, is possible.

A quick test of scaling at factors 0.5, 0.75, 1, 1.25, 1.5, 2, and 2.5 produces (100% magnification, blue is unscaled):

scaling equations

Could be an option worth exploring, perhaps.

Performance: Resetting 000s of symbols etc (or however many) is about 5-8 seconds, so 7 such changes is about half a minute.

MWE

\documentclass{article}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmainfont{Tex Gyre Pagella}
\setmathfont{Tex Gyre Pagella Math}[Colour=blue]

\newcommand\smathscale[1][1]{%
\setmathfont{Tex Gyre Pagella Math}[Scale=#1]
}
\newcommand\smathscalea{\smathscale[0.5]}
\newcommand\smathscaleb{\smathscale[0.75]}
\newcommand\smathscalec{\smathscale}
\newcommand\smathscaled{\smathscale[1.25]}
\newcommand\smathscalee{\smathscale[1.5]}
\newcommand\smathscalef{\smathscale[2]}
\newcommand\smathscaleg{\smathscale[2.5]}

\newcommand\testmaths{%
\begin{equation}
  \begin{cases}
    e^{i\pi}+1=0
  \end{cases}
\end{equation}}


\begin{document}
\testmaths
\smathscalea\testmaths
\smathscaleb\testmaths
\smathscalec\testmaths
\smathscaled\testmaths
\smathscalee\testmaths
\smathscalef\testmaths
\smathscaleg\testmaths

\end{document}

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.