# Redefine a command, including its arguments, to to do nothing

I want to easily typeset my documents without all references (the reason is that I need a version of the document without footnotes to count the words without footnotes). I use biblatex to create the footnotes. So what I do is have the following lines in the preamble, which are commented out for regular use, but not commented out when I want the document without the footnotes.

\def\autocite(#1)(#2)(#3){}
\def\autocites(#1)(#2)(#3){}
\providecommand{\pno}{\relax}
\providecommand{\psqq}{\relax}


The question refers to the first two lines. Since \autocite(s) takes arguments, I redefined it according to the answer here. But this yields in the following error for every citation:

Use of \autocites doesn't match its definition.

If you define a macro like this:

\def\autocite(#1)(#2)(#3){}


it must be followed by ( etc. They are not optional. This technique works in the linked answer because there the parentheses are not optional.

If you want to replace these macros you need to define them with the same optional and mandatory arguments. The \autocites macro seems to have a lot of possible optional arguments! You can use the xparse package to easily define such a macro.

• That looks promising. It works pretty well, and gets rid of most citations. – jjbornheim Mar 7 '11 at 18:04
• @jbornheim: It would be nice if you could post the final solution somewhere. – Martin Scharrer Mar 7 '11 at 18:06
• I use: \DeclareDocumentCommand\autocite{oom}{} \DeclareDocumentCommand\autocites{d()oomoog}{} It gets rid of most citations. So \autocites vanishes as far as the first two citations are concerned. But then my guess would have been that to remove additional citations, I would just continue oog until having as many arguments defined for \autocites as my longest footnote. But already after the second oog I get: "trying to define the command \\autocites' with 10 arguments but I only allow 0-9 arguments. Perhaps you forgot to use a colon in the function name?" – jjbornheim Mar 7 '11 at 18:12
• @jbornheim: A macro can only have a maximum of nine arguments. You need to define a second one which is called by the first one if you have more than that. – Martin Scharrer Mar 7 '11 at 18:14
• @Herbert: Yes, of course. I just was under the impression he wants to always disable the commands. I will delete that part. Like it is written at the moment it isn't correct. Thanks for pointing this out. – Martin Scharrer Mar 7 '11 at 19:24

Quite frankly, I didn't know how to do the macro thing. So here is what I came up with instead. I redefined \autocite just like Martin suggested, using the xparse package. Thanks for the pointer! Then, using the \DeclareMultiCiteCommand that is built into BibLatex, I mapped \autocites to \autocite. Here is the code:

\usepackage{xparse}
\DeclareDocumentCommand\autocite{oom}{}
\DeclareMultiCiteCommand{\footcites}[\autocite]{\relax}{}
\let\pno\relax
\let\psqq\relax


Note that the \footcites would need to be replaced by whatever you use for citations. So now I can switch citations/footnotes on and off.

• It's a bit strange to start an answer with "@Martin". I've taken the liberty to reword that slightly. – Hendrik Vogt Mar 7 '11 at 21:03

the commands are definied and used with another syntax, for example:

\autocite[ prenote ][ postnote ]{ key }
`

You have to redefinie this one.