如何使用 bibtex 從書目排序中排除 frontmatter 中的引用?

如何使用 bibtex 從書目排序中排除 frontmatter 中的引用?

在我的博士論文中,我必須在其中包含幾頁內容,其中frontmatter披露某些章節已作為論文發表,包括對論文的引用。這些引文隨後顯示為[1][2]等,因為它們是第一個被使用的。

因此,在我的介紹中,第一個引用以[5].有沒有辦法強制 bibtex 實際上開始從引言(在mainmatter)中對我的引文進行排序,以便這些引文從 開始[1],並且在 中的引文frontmatter在末尾計數?

我使用的unsrt樣式沒有額外的套件和report文檔類別。

答案1

你應該能夠使用

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

在你的前面,然後

\nocite{aaa}

在最後。

這會在您需要的地方進行正常引用,但會阻止將 bibcite 行寫入 aux 檔案。那麼您需要\nocite稍後寫入 aux 檔案並將條目放入生成的參考書目中。

答案2

你可以按照David的想法修改frontmatterand :mainmatter

\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}

當然,您可以透過重新定義來達到相同的效果\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}

這兩種解決方案都基於大衛提供的想法。

相關內容