# Compile but don't print references [duplicate]

Possible Duplicate:
Citations with no bibliography at the end

I have a document with a very tight space restriction and I've found that it is easier to compact my references by copying them from a compiled PDF into the document. However this obviously gives two copies of the bibliography in the document. Is there any way in which to compile the references for a document, so that the citations are numbered correctly etc. but not actually print the references?

-

## marked as duplicate by egreg, Seamus, lockstep, Stefan Kottwitz♦Jan 13 '12 at 15:18

run your document as usual and then run it one time with a commented %\blibliography{...}

-
...since this will still use the saved .aux file containing the correct references to produce the document. Compiling twice will use the updated (now void of \bibitems) .aux resulting in undefined citations. – Werner Oct 27 '11 at 18:38
please read, what I wrote! – Herbert Oct 27 '11 at 18:42
...I did, and elaborated. – Werner Oct 27 '11 at 18:44
it is obvious that I get no citations when running twice! – Herbert Oct 27 '11 at 18:46
You provided an elegant and straight-forward solution to the problem. – Werner Oct 27 '11 at 18:50

Try this:

\makeatletter
\def\bibliography#1{%
\if@filesw
\immediate\write\@auxout{\string\bibdata{#1}}%
\fi}
\makeatother


Note that in latex.ltx this command is defined as

\def\bibliography#1{%
\if@filesw
\immediate\write\@auxout{\string\bibdata{#1}}%
\fi
\@input@{\jobname.bbl}}


This command writes the bibliography files to the .aux file, and the last line reads the .bbl file and inserts it at the point. By redefining the command you keep the first part and get rid of the last one.

-
Would you care to elaborate on your answer? Suggesting "Try this..." or "Here you go..." solutions provides little context and no justification as to the choice of your code. – Werner Oct 27 '11 at 18:24
<em>Would you care to elaborate on your answer? Suggesting "Try this..." or "Here you go..." solutions provides little context and no justification as to the choice of your cod</em><br> Surely – Boris Oct 27 '11 at 18:48