I am using a class file that defines commands to change the font and font sizes for normal text for different sections of the document, but it leaves the math mode and equation font and font sizes unchanged. Consequently, in one of the sections, all the math is huge compared to the text (and in the wrong font). How do I change the font and font size for all the math in a particular section?
[Tex/LaTex] Specify font and font size for equations and math mode?
equationsfontsizemath-mode
Related Solutions
Use \DeclareMathSizes{S}{t}{s}{ss}
, which sets the math text font to size t
, the scriptsize math font to size s
, and the scriptscriptsize math font to ss
whenever the main text font size is set to S
.
\documentclass{article}
\usepackage{lmodern}
\DeclareMathSizes{7}{7}{5}{4} % \scriptsize is 7 pt
\DeclareMathSizes{5}{5}{3}{2} % \tiny is 5 pt
\begin{document}
\tracingmacros=2
{\tiny$(x_{i_1},y_{i_1})$} is in tiny font.
\noindent{\scriptsize$(x_{i_1},y_{i_1})$} is in scriptsize font.
\noindent$(x_{i_1},y_{i_1})$ is in normal font.
\end{document}
Don't overdo this, though: Tiny fonts can be really hard to read. There is a reason why the standard is \DeclareMathSizes{5}{5}{5}{5}
. I.e., when \tiny
is in effect (so the standard text font size is 5pt (assume 10pt in the main document) then all three math font sizes (text, script, scriptscript) will be 5pt. The thinking is probably that anything less than 5pt is unreadable.
Also, note my use of the lmodern
package. The standard computer modern fonts don't have sizes that small, so the 5pt version is substituted even if you specify a smaller size.
The Problem lies within the definition of \textsuperscript
that uses math mode.
\DeclareRobustCommand*\textsuperscript[1]{%
\@textsuperscript{\selectfont#1}}
\def\@textsuperscript#1{%
{\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}}
A possible workaround is redefining the actual command so that it will not get in the way with your equations, this needs graphicx
:
\renewcommand{\textsuperscript}[1]{\raisebox{0.8ex}{\scalebox{0.66}{#1}}}
Or this needs relsize
\renewcommand{\textsuperscript}[1]{\raisebox{0.8ex}{\smaller{#1}}}
I admit that this is just an easy workaround emulating the typrsetting of superscripts. It might be possible, that modern typography defines super/subscript in a certain way.
This also works with various enlargements of text sizes. This MWE also emulates a textsubscript:
\documentclass[12pt,oneside,letterpaper,titlepage]{article}
\DeclareMathSizes{12}{20}{14}{10}
%% Solution 1
\usepackage{relsize} %smaller
\renewcommand{\textsuperscript}[1]{\raisebox{0.8ex}{\smaller{#1}}}
\newcommand{\textsubscript}[1]{\raisebox{-0.4ex}{\smaller{#1}}}
%% Solution 2
%%\usepackage{graphicx} %scalebox
%%\renewcommand{\textsuperscript}[1]{\raisebox{0.8ex}{\scalebox{0.66}{#1}}}
%%\newcommand{\textsubscript}[1]{\raisebox{-0.4ex}{\scalebox{0.66}{#1}}}
\begin{document}
...modulation by Ca\textsuperscript{2+}...
...soluted in water H\textsubscript{2}O...\\
\tiny Ca\textsuperscript{2+}
\scriptsize Ca\textsuperscript{2+}
\footnotesize Ca\textsuperscript{2+}
\small Ca\textsuperscript{2+}
\normalsize Ca\textsuperscript{2+}
\large Ca\textsuperscript{2+}
\Large Ca\textsuperscript{2+}
\LARGE Ca\textsuperscript{2+}
\huge Ca\textsuperscript{2+}
\Huge Ca\textsuperscript{2+}
\normalsize
\begin{equation}
\sigma^2 = iI - \frac{I^2}{N}
\end{equation}
\end{document}
Further reading relsize and graphicx.
For chemistry typesetting (I guessed that on the calcium bit) there are some packages available, like bpchem or mhchem, that handle formulas quite well.
Best Answer
I just found something over at Stack Overflow that works for me: