6

In my PhD thesis I have to include a few pages in the frontmatter that disclose that some chapters have been published as papers, including citations to the papers. These citations then appear as [1], [2], etc. since they are the first to be used.

As a result, in my introduction, the first citation ends up as [5]. Is there a way to force bibtex to actually start ordering my citations from the introduction (in mainmatter) so that these citations start at [1], and those in the frontmatter are counted at the end?

I'm using the unsrt style with no extra packages, and the report document class.

3
  • Which documentclass do you use? Commented Apr 11, 2013 at 17:29
  • 1
    Does \usepackage{notoccite} take care of it? Commented Apr 11, 2013 at 17:43
  • But do you want to keep the [1], [2], etc. format for your publications section or you want them to appear as they would in the Bibliography section? Commented Apr 11, 2013 at 18:18

2 Answers 2

6

You should be able to use

{\csname @fileswfalse\endcsname\cite{aaa}}

in your front matter and then

\nocite{aaa}

at the end.

This does a normal cite where you need it but stops it writing the bibcite line to the aux file. then you need a \nocite later to write to the aux file and get the entry put in the generated bibliography.

1
  • Thanks David, given that each of these citations appear somewhere else in the text, I technically don't need the \nocite at the end, but this is exactly what I need! Commented Apr 11, 2013 at 21:38
4

You can modify frontmatter and mainmatter with the idea of David:

\documentclass{book}

\usepackage{letltxmacro}
\makeatletter
\LetLtxMacro\@citexOrig\@citex
\g@addto@macro\frontmatter{%
\def\@citex[#1]#2{\leavevmode
  \let\@citea\@empty
  \@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{,\penalty\@m\ }%
     \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
%     \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
     \@ifundefined{b@\@citeb}{\hbox{\reset@font\bfseries ?}%
       \G@refundefinedtrue
       \@latex@warning
         {Citation `\@citeb' on page \thepage \space undefined}}%
       {\@cite@ofmt{\csname b@\@citeb\endcsname}}}}{#1}%
   \AtEndDocument{\nocite{#2}}%
  }%
}
\g@addto@macro\mainmatter{\LetLtxMacro\@citex\@citexOrig}
\makeatother

\usepackage{lipsum}
\begin{document}
\frontmatter
frontmatter Text \cite{article-full} and \cite{article-minimal}

\mainmatter
mainmatter Text \cite{book-full} and \cite{book-minimal}

\bibliography{xampl}
\bibliographystyle{unsrt}

\end{document}

Of course you can reach the same with a redefinition of \cite

\documentclass{book}

\usepackage{letltxmacro}
\makeatletter
\LetLtxMacro\citeOrig\cite
\g@addto@macro\frontmatter{%
 \renewcommand*\cite[2][]{%
   \ifx\relax#1\relax {\@fileswfalse\citeOrig{#2}}\else {\@fileswfalse\citeOrig[#1]{#2}}\fi%
    \AtEndDocument{\nocite{#2}}%
  }%
}
\g@addto@macro\mainmatter{\LetLtxMacro\cite\citeOrig}
\makeatother

\usepackage{lipsum}
\begin{document}
\frontmatter
frontmatter Text \cite{article-full} and \cite{article-minimal}

\mainmatter
mainmatter Text \cite{book-full} and \cite{book-minimal}

\bibliography{xampl}
\bibliographystyle{unsrt}

\end{document}

Both solution based on the idea provided by David.

1
  • Thanks Marco. I accepted David's answer above since it was the simpler of the two, but yours is ideal to add to my document class - saving other users the trouble of finding the same above trick. Commented Apr 11, 2013 at 21:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .