Setting Spacing for Mathematical Formula Fonts #
Author: Erhua
Keywords: Mathematical Formulas, Fonts, Spacing
In this section, we will discuss the font issues of mathematical formulas.
Changing the Font of Mathematical Formulas #
Setting the Font #
Mathematical fonts are generally used in conjunction with corresponding English fonts. The setting method is as follows (requires the use of the unicode-math package):
\usepackage{unicode-math}
\setmathfont{PostScript name of the mathematical font}
% Note:
% It is worth noting that the unicode-math package should be used before the fontspec package and the ctex package!
Example:
Be sure to note that the unicode-math package must be placed before the ctex and fontspec packages
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage{fontspec}
\setmainfont{Cambria}
\setmathfont{CambriaMath}
\usepackage[paperwidth = 200mm,paperheight = 150mm]{geometry}
\usepackage{ctex}
------
\begin{document}
This is just a test. \par
I know that we all get one thing, that we all share together. we all get one nice dream we live for. \par
test this article's equation: $a^2+b^2$
\begin{equation}
\alpha +\beta = \theta
\end{equation}
\begin{gather}
\sqrt{\mathstrut a}+\sqrt{\mathstrut b}=\sqrt{\mathstrut y}\\
\int \varGamma(x)\text{d}x = \pm \infty \notag \\
\iint_{z_0}^{z_1}\cos(s\pi z)\text{d}z
\end{gather}
\end{document}
Common Mathematical Fonts and Corresponding English Fonts #
Font | Corresponding Mathematical Font |
---|---|
Cambria | Cambria Math |
Latin Modern Roman | Latin Modern Math |
XITS | XITS Math |
Palatino | Asana Math |
Palatino | Neo Euler |
TeX Gyre Pagella | TG Pagella Math |
Changing the Font Size of Mathematical Formulas #
Note: The font size of mathematical formulas is controlled by the font size of the surrounding text.
In general, it is not necessary to modify the font size of mathematical formulas. However, there are times when we need to do so. Therefore, LaTeX also provides corresponding modification commands.
\DeclareMathSizes{display size}{text size}{script size}{scriptscript size}
Explanation:
The first set of braces "display size" represents the font size of the main text (only effective when it is the same as the font size of the document)
The second set of braces "text size" represents the font size of the normal formula
The third set of braces "script size" represents the font size of the first level superscript and subscript
The fourth set of braces "scriptscript size" represents the font size of the second level superscript and subscript
------
\renewcommand\defaultscriptratio{0.6}
% Set the size of superscript/subscript to be 0.6 times the size of the main text
------
\renewcommand\defaultscriptscriptratio{0.3}
% Set the size of small superscript/subscript to be 0.3 times the size of the main text