Site icon texblog

Undefining a command in LaTeX

I was editing a poster and didn’t know whether or not to include a bibliography. I had already added \cite commands and wanted to get an idea of what it looks like without bibliography. So I commented out \printbiliography to get rid of the bibliography, but the numbers were still in the text. Removing all \cite commands wasn’t an option in case I wanted to have them back.

At first, I tried to overwrite \cite with a command that doesn’t exist:

\let\cite\undefined % \undefined is not defined

This wouldn’t work because \cite becomes undefined and is still called in the text. The LaTeX engine returns “Undefined control sequence”.

The solution was to “renew” \cite to do nothing:

\renewcommand\cite[2][]{}
Exit mobile version