Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using \cite a lot in my document, but now I discovered that I really need \citep instead (from natbib). No problem, I thought, just redefine the \cite command:

\renewcommand{\cite}[1]{\citep{#1}}

That worked for the LaTeX version on my laptop (Mac), but on my Linux box this \renewcommand has no effect.

How can I safely redefine the \cite command, so that it works on all LaTeX distributions?

P.S.: The version where it didn't work is this:

pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian)
kpathsea version 5.0.0

Update: After \let didn't work either (see answer) I found the source of the trouble: I had the \usepackage{natbib} command after my \renewcommand{\cite} command. Changing the order fixed it.

share|improve this question
2  
The problem is solved, but a general tip for such cases: surround the \Renewcommand\foo with \show\foo, and put this again at a place where the command is used. You will see the changes to the macro. –  Charles Stewart Aug 18 '10 at 13:38

3 Answers 3

As you noted, the order matters. Note that you can get roughly the same effect of your \renewcommand with less work by doing

\renewcommand\cite{\citep}

That is, you don't need the argument. This can often be necessary for things like \url that change catcodes before looking at arguments, but probably don't make any difference in this case.

share|improve this answer
    
Not reading the argument oneself will also make life easier if the command in question has a starred form or other fancy variations. –  Ulrich Schwarz Feb 6 '11 at 11:59

You could try

\let\cite\citep

instead.

Update: after seeing your upated question: I assume \let would have worked if you would have placed it after \usepackage{natbib} as well. Generally, placing redefinitions after all packages have been loaded prevents macros from beeing accidentally overwritten.

share|improve this answer

These problems can be avoided by using \AtBeginDocument, for example:

\AtBeginDocument{\renewcommand\cite{\citep}}

If you are creating your own packages then this will allow you to load your package before natbib and still redefine the citation command.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.