I need to make one equation in an {align*}
env. to have very small font, since the matrix is too wide. So I use this method, found in how-can-i-change-the-font-size-in-math-equations
\begingroup
\everymath{\scriptsize}
\scriptsize
\begin{bmatrix}
.... very wide matrix here..
\end{bmatrix}
\endgroup
This always worked, even though I see LaTeX Font Warning: Command \scriptsize invalid in math mode on input line ....
all the time. So I ignored these since it works and it does make it scriptsize font.
But now what I tried it on normal math, i.e. not matrix environment, it had no effect, and the math size did not change.
I'd like to ask why it works for bmatrix
and not for normal math. Here is a MWE
\documentclass[11pt]{article}%
\usepackage{amsmath}
\usepackage{mathtools}
\begin{document}
\begin{align*}
T & =
\begingroup
\everymath{\scriptsize}
\scriptsize
\begin{bmatrix}
\cos(x) %this works, i.e. the font becomes scriptsize
\end{bmatrix}
\endgroup
\\
& =
\begin{bmatrix}
\cos(x) %this is to compare size with the above
\end{bmatrix}
\\
& =
\begingroup
\everymath{\scriptsize}
\scriptsize
\cos(x) %this does not work, font size does not change!
\endgroup
\end{align*}
\end{document}
Here is the pdf
We can see it did work for the first case, but not for normal math. Note that I need to change one equation inside a large align
env. And not the whole aligned env. So that is why I use this method as I do not know another way to do this.
Best Answer
First of all,
\everymath={\scriptsize}
is wrong. It somehow works, but with warnings. So, open an\hbox
which takes you out of math mode, select\scriptsize
, open a formula in\displaystyle
and, at the end, close the formula and the box.