17

Consider the following MWE:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{graphicx} % \scalebox
% defaults seem to be: pslatex.sty:103: \DeclareMathSizes{12}{12}{9}{7}
% NB: Font shape `OML/cmm/m/it' in size <16> not available, size <17.28> substituted on input line 6.
% \DeclareMathSizes{12}{17.28}{9}{7} % (a)
\begin{document}
Here I'll be trying a small example... First, I am writing an inline equation here: $a + b$; also comparing plain number 123 vs. $123$ as inline equation -- and here, below, I'm using display equation:

\begin{equation}%
% \large % (b)
% \scalebox{1.5}{ % (c)
f(y) = a \cdot k^{y} %
% } % (c)
\end{equation}

... and finally, I'm having a closing sentence, just to have some text after the display equation.

\end{document}

% # convert -density 150 test.pdf -crop 846x329+196+251 test_.png

Now - compiled as is, the output produced is:

test_01

That is the default output, and I'd like to change (in this case, increase/make larger) only the display equation's - the one in the equation environment - font size.

So, if I uncomment only statement (a) (with \DeclareMathSizes), I get this:

test_01a

The display equation size changed, and the equation numbering didn't, which is good - but the inline equations also changed size, which I don't want.

Then, if I uncomment only statement (b) from the posted MWE (with \large), I get:

test_01b

The display equation size changed, and the inline equations didn't, which is good - but also the equation numbering changed size, which I don't want.

Finally, if I uncomment only statement (c) from the posted MWE (with \scalebox and its closure) - I cannot even compile the MWE, as it fails with:

! Missing $ inserted.
<inserted text> 
                $
l.14 }
       % (c)
? X
No pages of output.
Transcript written on test.log.

So, how could I change only the math display equation font size? If there is a different approach for "case-by-case" (e.g. in individual equation blocks) setting, vs. a global setting (per document), that would be nice to know too.

4
  • 1
    Do you want to increase the size inside all equation environment through out the dcoument or is it only at some places?
    – user11232
    Commented Feb 14, 2014 at 12:53
  • Thanks for the comment, @HarishKumar - I cannot exactly tell, honestly, which is why the last sentence in OP is so undecided :) I think I'd like to change only at some places first; then if it turns out that in the document I write, most equations seem to need this increase, then I'd like to convert the individual changes to a single, global document setting. Cheers!
    – sdaau
    Commented Feb 14, 2014 at 12:56
  • Also related: Size commands do not work in mathmode - TeX - LaTeX Stack Exchange
    – sdaau
    Commented Feb 14, 2014 at 13:50
  • if the only problem were the size of the tag, this simple code replacement for amsmath fixes that: \makeatletter \def\maketag@@@#1{\hbox{\m@th\normalfont\normalsize#1}} \makeatother . however, it's not enough, since the vertical spacing is also affected badly by the change in size. Commented Feb 14, 2014 at 15:00

3 Answers 3

22

This defines a new environment myequation with the help of environ package:

\NewEnviron{myequation}{%
    \begin{equation}
    \scalebox{1.5}{$\BODY$}
    \end{equation}
    }

Code:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{graphicx} % \scalebox
\usepackage{environ}
\NewEnviron{myequation}{%
\begin{equation}
\scalebox{1.5}{$\BODY$}
\end{equation}
}

\begin{document}
Here I'll be trying a small example... First, I am writing an inline equation here: $a + b$; also comparing plain number 123 vs. $123$ as inline equation -- and here, below, I'm using display equation:
%% Don't leave this line empty
\begin{myequation}%
f(y) = a \cdot k^{y} %
\end{myequation}
%
... and finally, I'm having a closing sentence, just to have some text after the display equation.

\end{document}

enter image description here

4
  • Many thanks for that, @HarishKumar - I was thinking there is maybe some command/parameter I could change, and keep on using equation; but this confirms that is probably not the way to do it. Thanks again - cheers!
    – sdaau
    Commented Feb 14, 2014 at 13:25
  • 1
    @sdaau You are welcome. Glad it helped :)
    – user11232
    Commented Feb 14, 2014 at 13:29
  • 2
    Note that math mode is turned to inline instead of displayed (as regular equations). $\displaystyle \BODY$ fixes this.
    – arauzo
    Commented Jan 23, 2018 at 16:31
  • Is there any way to only change the equation size but not the \text{..} size inside the environment?
    – Hawkingo
    Commented Apr 10, 2020 at 13:57
6

Just to make a note - via this answer: Setting math font size - TeX - LaTeX Stack Exchange; I also got this to work (\mbox + \fontsize + \() with the equation environment (just the equation snippet here, without the rest of the MWE):

\begin{equation}% 
\mbox{\fontsize{17.28}{21.6}\selectfont\( %
f(y) = a \cdot k^{y} %
\)} %
\end{equation}

Also this seems to work (\Large instead of \fontsize):

\begin{equation}% 
\mbox{\Large\( %
f(y) = a \cdot k^{y} %
\)} %
\end{equation}

The important quote from there seems to be:

... need to switch out of math mode, use a lower level font size change such as \fontsize ... and then switch back into math mode using \( not $ ...

Another quote that may clarify, from How to change the size of formulas? - Wikidot Community:

You'll also note that there's some \mbox weirdness in there. The font selection command don't work in math mode ... So, we use the \mbox to create a little text-mode environment inside the equation, change the font, and declare an equation inside the text box. Sort of like Russian dolls, but it works.

(Note that the weird font sizes above are so as to avoid "LaTeX Font Warning: Font shape `OMX/cmex/m/n' in size <16> not available, size <17.28> substituted on input line 15.")

1
  • What about \everydisplay\expandafter{\the\everydisplay\small }. It will make all display math in \small font size including equation numbers
    – Linuxss
    Commented Sep 15, 2016 at 8:01
4

You can use the relsizepackage, which has a \mathlargercommand. If you use it in one of the amsmath environments, you have to repeat the command for each part of the formulae (not working with &and \\:

           \documentclass[a4paper,12pt]{article}
            \usepackage{amsmath}
            \usepackage{graphicx} %
            \usepackage{relsize}

            \begin{document}
            Here I'll be trying a small example... First, I am writing an inline equation here: $a + b$; also comparing plain number 123 vs. $123$ as inline equation -- and here, below, I'm using display equation:
            \begin{align}
            f(z)  & = a \cdot k^{z} \\%
            \mathlarger{f(z) } & = \mathlarger{a \cdot k^{z}}
            \end{align}
            ... and finally, I'm having a closing sentence, just to have some text after the display equation.

            \end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .