%%
%% The LaTeX Companion, 3ed
%%
%% Example 11-4-19 on page II-171 in "Modular relations".
%%
%% Copyright (C) 2022 Frank Mittelbach
%%
%% It may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%%
%% See
https://www.latex-project.org/lppl.txt for details.
%%
\documentclass{tlc3examargin}
\pagestyle{empty}
\setcounter{page}{6}
\setlength\textwidth{183.0pt}
% Shorten the vertical size of the example ...
\AtBeginDocument{%
\setlength\abovedisplayskip{.8\abovedisplayskip}%
\setlength\belowdisplayskip{.8\belowdisplayskip}%
}
%StartShownPreambleCommands
\usepackage{amsmath}
%StopShownPreambleCommands
\begin{document}
\begin{align*}
u & \equiv v + 1 \mod{n^2} \\
u & \equiv v + 1 \bmod{n^2} \\
u & = v + 1 \pmod{n^2} \\
u & = v + 1 \pod{n^2} \end{align*}
The in-text layout: $ u = v + 1 \pmod{n^2} $
\begin{align*}
k^2 &= (m \bmod n) \, ; &
x &\equiv y \pmod b \, ; \\
x &\equiv y \mod c \, ; &
x &\equiv y \pod d \, . \end{align*}
\end{document}