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.

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.

share|improve this question
    
Which documentclass do you use? –  Marco Daniel Apr 11 '13 at 17:29
    
Does \usepackage{notoccite} take care of it? –  Steven B. Segletes Apr 11 '13 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? –  Mario S. E. Apr 11 '13 at 18:18
add comment

2 Answers

up vote 4 down vote accepted

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.

share|improve this answer
    
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! –  Duncan Macleod Apr 11 '13 at 21:38
add comment

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.

share|improve this answer
    
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. –  Duncan Macleod Apr 11 '13 at 21:40
add comment

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.