Debian Codegraph @

texmf-dist/doc/latex/medmath/medmath.tex

raw
1 % -*- coding: utf-8 -*-
2 \documentclass[oneside,11pt]{article}
3 \usepackage[a4paper,margin=2cm]{geometry}
4
5 \newcommand*{\myversion}{2025A}
6 \newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)}
7 \newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi}
8
9 \setlength{\parindent}{0pt}
10 \setlength{\parskip}{4pt plus 1pt minus 1pt}
11
12 \usepackage{enumerate}
13 \usepackage{codehigh}
14 \usepackage{hyperref}
15 \hypersetup{
16 colorlinks=true,
17 urlcolor=blue3,
18 linkcolor=green3,
19 }
20
21 %% The \oiint operator is defined with utopia font
22 \usepackage[utopia]{mathdesign}
23
24 \usepackage[mediummath]{nccmath}
25 \usepackage{medmath}
26 \booltrue{mdm@bare}
27
28 \NewDocumentCommand\mypkg{m}{\textcolor{blue3}{\mbox{#1}}}
29 \NewDocumentCommand\myopt{m}{\textcolor{yellow3}{\mbox{#1}}}
30 \NewDocumentCommand\mycmd{m}{\textcolor{green3}{\ttfamily\fakeverb{#1}}}
31
32 \begin{document}
33
34 \title{\textsf{\color{green3}The \texttt{medmath} package}}
35 \author{Jianrui Lyu ([email protected])}
36 \date{\mydate}
37 \maketitle
38
39 \section{Introduction}
40
41 \subsection{The \texttt{mediummath} option in \texttt{nccmath} package}
42
43 There are several problems with \myopt{mediummath} option in \mypkg{nccmath} package.
44
45 \begin{enumerate}
46 \item The big operators in superscripts and subscripts are too large.
47 \begin{demohigh}
48 \[A^{\sum_{0}^{1}x}=B\]
49 \end{demohigh}
50 \item The definite integrals inside \texttt{cases} environment sometimes cause infinite loops.
51 \begin{codehigh}
52 \[\begin{cases}
53 a & \int_1^t
54 \end{cases}\]
55 \end{codehigh}
56 \item The \verb!\oiint! operators are not scaled to medium size.
57 \begin{demohigh}
58 \[\oiint_{\Sigma}xyzdS=\frac{\sqrt{3}}{120}\]
59 \end{demohigh}
60 \end{enumerate}
61
62 \subsection{The \texttt{medmath} package}
63
64 \makeatletter
65 \mdm@activate@all
66 \makeatother
67
68 The \mypkg{medmath} package started as a fork of \myopt{mediummath} code in \mypkg{nccmath}
69 package, aiming to provide more stable and flexible medium-size math commands.
70
71 \begin{enumerate}
72 \item The big operators in superscripts and subscripts are in medium size.
73 \begin{demohigh}
74 \[A^{\sum_{0}^{1}x}=B\]
75 \end{demohigh}
76 \item The definite integrals inside \texttt{cases} environment always work.
77 \begin{demohigh}
78 \[\begin{cases}
79 a & \int_1^t
80 \end{cases}\]
81 \end{demohigh}
82 \item The \verb!\oiint! operators are scaled to medium size.
83 \begin{demohigh}
84 \[\oiint_{\Sigma}xyzdS=\frac{\sqrt{3}}{120}\]
85 \end{demohigh}
86 \end{enumerate}
87
88 \section{Usage}
89
90 Since \mypkg{medmath} package is a fork of \myopt{mediummath} option in \mypkg{nccmath}
91 package, the usage is basically the same. Here is a minimal example:
92
93 \begin{codehigh}
94 \documentclass{article}
95 \usepackage{medmath}
96 \begin{document}
97 Inline $\int_0^1x^2dx=\frac13$.
98 Displayed \[ \int_0^1x^2dx=\frac13. \]
99 \end{document}
100 \end{codehigh}
101 \vspace{0.5em}\hrule
102 Inline $\int_0^1x^2dx=\frac13$.
103 Displayed \[ \int_0^1x^2dx=\frac13. \]
104 \hrule\vspace{0.5em}
105
106 You will see that both integral symbols and both fractions are in medium size.
107 You could see the differences if you remove \mycmd{\usepackage{medmath}} line.
108
109 Since version 2024E, \mypkg{medmath} package is able to adjust \mycmd{\medintcorr} for some math fonts,
110 hence integral operators with subscripts will look better. As a start, only three fonts
111 (Computer Modern, Mathdesign Utopia, and Mathdesign Charter) are detected.
112
113
114 \end{document}