# Repetition of \def commands

Below is my code

\documentclass{article}

\def\a{\alpha}
\def\b{\beta}
\def\a{\theta}

\newcommand\s{\alpha}
\newcommand\f{\beta}
\newcommand\s{\theta}

\begin{document}

Sample Text $\a$

\end{document}

My problem is I want to show error while compiling the document if I have multiple \def in same name, for example \def\a repeated twice, for \newcommand it shows error if mentioned twice, likewise I need for \def too, please guide,

• \def is a TeX primitive and very deliberately doesn't do any checks: why can you not stick to \newcommand? – Joseph Wright Sep 29 '15 at 12:05
• @JosephWright problem is we don't code the Latex files, it is being coded somewhere, where we can't give instructions to them to use a specific commands, Is it possible to make it check?? – user52124 Sep 29 '15 at 12:06
• @user52124: Do you want to have something like \ifdef from etoolbox? – user31729 Sep 29 '15 at 12:12
• @ChristianHupfer just need a Error message when i compile the Tex using PDFLATEX – user52124 Sep 29 '15 at 12:15
• @user52124: I've posted an example. – user31729 Sep 29 '15 at 12:15