Command \nr already defined (datetime2 and nccmath incompatibility)
Yes, they have a small incompatibility. The nccmath
defines \nr
to be equivalent to \\[0.5ex]
. If you will not use this shortcut, then the solution proposed by @Zarko will work: nccmath
will define \nr
and datetime2
will overwrite it without problems.
But if you would like to have the \nr
shortcut then that won't work. datetime2
uses \nr
as a temporary macro to hold a number. You can redefine that to use another name, so the clash doesn't happen. Add this to your preamble after loading datetime2
and before nccmath
:
\makeatletter
\define@choicekey{datetime2.sty}{useregional}[\DTM@val\DTM@nr]%
{false,text,numeric,num}[text]%
{%
\ifcase\DTM@nr\relax
\renewcommand*{\DTMifcaseregional}[3]{##1}%
\or
\renewcommand*{\DTMifcaseregional}[3]{##2}%
\or
\renewcommand*{\DTMifcaseregional}[3]{##3}%
\or
\renewcommand*{\DTMifcaseregional}[3]{##3}%
\fi
}
\let\nr\relax
\makeatother
MWE:
\documentclass{article}
\usepackage[useregional]{datetime2}
\makeatletter
\define@choicekey{datetime2.sty}{useregional}[\DTM@val\DTM@nr]%
{false,text,numeric,num}[text]%
{%
\ifcase\DTM@nr\relax
\renewcommand*{\DTMifcaseregional}[3]{##1}%
\or
\renewcommand*{\DTMifcaseregional}[3]{##2}%
\or
\renewcommand*{\DTMifcaseregional}[3]{##3}%
\or
\renewcommand*{\DTMifcaseregional}[3]{##3}%
\fi
}
\let\nr\relax
\makeatother
\usepackage{nccmath}
\usepackage{lipsum}
\title{Example}
\author{Isabella B.}
\begin{document}
\maketitle
\lipsum[1]
\useshortskip
\[ 2\times2=4 \]
\lipsum[1]
\end{document}
You can load packages in this order, neutralising the \nr
command from nccmath
:
\usepackage{nccmath}%
\let\nr\relax%
\usepackage[useregional]{datetime2}
You can replace the nccmath \nr
either with what it's for: \\[0.5ex]
, or use the linespread
environment from mathtools
(needless to load amsmath
in this case).