%  -*- coding: utf-8 -*-
\documentclass[oneside,12pt]{article}
\usepackage[a4paper,margin=2cm]{geometry}

\newcommand*{\myversion}{2024B}
\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)}
\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi}

\setlength{\parindent}{0pt}
\setlength{\parskip}{4pt plus 1pt minus 1pt}

\usepackage{enumerate}
\usepackage{codehigh}
\usepackage{hyperref}
\hypersetup{
  colorlinks=true,
  urlcolor=blue3,
  linkcolor=green3,
}

%% The \oiint operator is defined with utopia font
\usepackage[utopia]{mathdesign}

%\usepackage[mediummath]{nccmath}
\usepackage{medmath}
\makeatletter
\mdm@enabledfalse
\makeatother

\begin{document}

\title{\textsf{\color{green3}The \texttt{medmath} package}}
\author{Jianrui Lyu (tolvjr@163.com)}
\date{\mydate}
\maketitle

\section{The \texttt{mediummath} option in \texttt{nccmath} package}

There are several problems with \texttt{mediummath} option in \texttt{nccmath} package.

\begin{enumerate}
  \item The big operators in superscripts and subscripts are too large.
\begin{demohigh}
\[A^{\sum_{0}^{1}x}=B\]
\end{demohigh}
  \item The definite integrals inside \texttt{cases} environment sometimes cause infinite loops.
\begin{codehigh}
\[\begin{cases}
 a & \int_1^t
\end{cases}\]
\end{codehigh}
  \item The \verb!\oiint! operators are not scaled to medium size.
\begin{demohigh}
\[\oiint_{\Sigma}xyzdS=\frac{\sqrt{3}}{120}\]
\end{demohigh}
\end{enumerate}

\section{The \texttt{medmath} package}

\makeatletter
\my@do@medmath \my@do@medmath@fix
\makeatother

The \texttt{medmath} package fixes and improves \texttt{mediummath} option in \texttt{nccmath} package.

\begin{enumerate}
  \item The big operators in superscripts and subscripts are in medium size.
\begin{demohigh}
\[A^{\sum_{0}^{1}x}=B\]
\end{demohigh}
  \item The definite integrals inside \texttt{cases} environment always work.
\begin{demohigh}
\[\begin{cases}
 a & \int_1^t
\end{cases}\]
\end{demohigh}
  \item The \verb!\oiint! operators are scaled to medium size.
\begin{demohigh}
\[\oiint_{\Sigma}xyzdS=\frac{\sqrt{3}}{120}\]
\end{demohigh}
\end{enumerate}

\end{document}
