LaTeX packages for the working mathematician

I’ve written small LaTeX packages to help me write down solutions to Algebra and Cathegory Theory exercises. Most of the commands provided by the package are simply short-hands for symbols in amssymb. Here are the first two files:

For updated versions of the packages in here see git.pablopie.xyz/latex-setup/README.html

xalgebra.sty

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{xalgebra}[2020/09/10 1.0.0 Usefull definitions for Algebra]

\RequirePackage{amssymb} % For the standard sets
\RequirePackage{amsmath} % For the \DeclareMathOperator

% Standard sets
\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\CC}{\mathbb{C}}

% Linear Algebra stuff
\DeclareMathOperator{\vspan}{span} % Set span
\DeclareMathOperator{\Tr}{Tr}      % Operator trace
\DeclareMathOperator{\Id}{Id}      % Identity operator
\DeclareMathOperator{\Bil}{Bil}    % The space of bilinear maps
\DeclareMathOperator{\Mat}{Mat}    % Matrix algebra
\newcommand{\norm}[1]{\left\lVert\nobreak#1\nobreak\right\rVert} % Vector norm

% Group Theory stuff
\newcommand{\gord}[1]{\left|\nobreak#1\nobreak\right|} % Group order
\newcommand{\perm}{\mathfrak{S}}   % Permutation group
\DeclareMathOperator{\Inn}{Inn}    % Inner automorphism group
\DeclareMathOperator{\Out}{Out}    % Outer automorphism group
\DeclareMathOperator{\sgn}{sgn}    % Permutation sign (parity)
\DeclareMathOperator{\GL}{GL}      % General linear group

% Ring Theory stuff
\DeclareMathOperator{\Frac}{Frac}  % Field of fractions
\DeclareMathOperator{\fchar}{char} % Field characteristic

% Representation Theory stuff
\DeclareMathOperator{\Rad}{Rad} % Jacobson radical

\endinput

functional.sty

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{functional}
  [2020/09/10 1.0.0 Usefull definitions for Category Theory]

\RequirePackage{amsmath}

\DeclareMathOperator{\Obj}{Obj} % The class of objects of a category
\DeclareMathOperator{\Hom}{Hom} % The class of morphisms of a category
\DeclareMathOperator{\End}{End} % Endomorphisms
\DeclareMathOperator{\Aut}{Aut} % Automorphisms

% Function stuff
\DeclareMathOperator{\dom}{dom}     % The domain of a morphism
\DeclareMathOperator{\codom}{codom} % The codomain of a morphism
\DeclareMathOperator{\im}{im}       % The image of morphism
\DeclareMathOperator{\id}{id}       % Identity function
\newcommand{\To}{\Rightarrow}       % Natural transformation

\endinput

I think both this packges are pretty self-explanatory. To use any of the macros declared in this packages simply require the package and call \<macro name>. There’s another package which isn’t as simple as this two though:

xexercise.sty

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{xexercise}[2020/09/10 1.0.0 Usefull definitions for exercise solutions]

\RequirePackage{enumitem}
\RequirePackage{kvoptions}

\SetupKeyvalOptions{
  family=xexercise,
  prefix=xexercise@
}

\DeclareStringOption[Exercise]{exerciselabel}
\ProcessKeyvalOptions*

\newcounter{exercise}

% Option to reset the exercise label
\newcommand{\setexerciselabel}[1]
  {\renewcommand{\xexercise@exerciselabel}{#1}}

% Exercise
\newenvironment{exercise}[1][\theexercise]
  {\stepcounter{exercise}\noindent {\bfseries \xexercise@exerciselabel\, #1. }}
  {}

% Exercise items ((a), (b), (c), ...)
\newenvironment{exerciseitems}
  {\begin{enumerate}[label={\bfseries(\alph*)}]}
  {\end{enumerate}}

\endinput

The xerxercise package is an alternative to the exercises package. It’s mostly meant for writing down exercise solutions. The exercise environment is similar to an amsmthm’s theorem environments:

\begin{exercise}
  Write down your solution in here.
\end{exercise}
Example of how the exercise environment is rendered
Example of how the exercise environment is rendered

If you want to customize the number in the heading of the environment, you can do the following:

\begin{exercise}[2.3.4]
  Write down your solution in here.
\end{exercise}
Example of how custumized headings are rendered
Example of how custumized headings are rendered

If you want to customize the label in the heading of the environment you can set the exerciselabel parameter when requirering the package:

\usepackage[exerciselabel=Foo]{xerxercise}

\begin{exercise}
  Write down your solution in here.
\end{exercise}
Example of how custumized headings are rendered
Example of how custumized headings are rendered

You can also call the \setexerciselabel command:

\usepackage{xerxercise}

\setexerciselabel{Foo}

\begin{exercise}
  Write down your solution in here.
\end{exercise}
Example of \setexerciselabel
Example of \setexerciselabel

Furthermore, there’s the exerciseitems environment, which is meant for writting down solutions to specific items of an exercise:

\begin{exercise}
  \begin{exerciseitems}
  \item Item a.
  \item Item b.
  \item Item c.
  \end{exerciseitems}
\end{exercise}
Example of how the exercisesitems environment is rendered
Example of how the exercisesitems environment is rendered

If you’re using Overleaf you can install the packages by simply placing them in the root folder of your project. If you’re using TeXLive you can install the packages by placing the .sty files in $TEXMFHOME/tex/latex/. The packages are still in active development, I encorage anyone to send me suggestions — just send me an email!