Last time I asked: How to check if command is used more than once?
This time I want LaTeX to throw an error message if two or more commands have the same definiton.
This is allowed
\documentclass{article}
\newcommand{\one}{Definition 1}
\newcommand{\two}{Definition 2}
\newcommand{\three}{Definition 3}
\begin{document}
\one
\two
\three
\end{document}
This is should throw an error message
\documentclass{article}
\newcommand{\one}{Definition 1}
\newcommand{\two}{Definition 1} % Definition already exists!
\newcommand{\three}{Definition 3}
\begin{document}
\one
\two
\three
\end{document}
EDIT
- I'd like to have the error at point of definition.
- It's an error if the definition already exists in another command.