未分类的引用和浮动

未分类的引用和浮动

在尝试回答这个问题时按出现顺序引用很明显,未排序的引用方案(引用仅按出现顺序编号的方案)很容易与浮点数混淆。下面是一个展示该问题的最小示例。

\documentclass[12pt,oneside]{book}
\usepackage[super,sort&compress]{natbib}
\bibpunct{[}{]}{,}{s}{}{} 
\bibliographystyle{unsrtnat}
\usepackage{hyperref}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\usepackage{filecontents}
\usepackage{caption}
\begin{filecontents}{\jobname.bib}
@incollection{Baauw2001,
    Address = {Somerville, MA},
    Author = {Sergio Baauw},
    Booktitle = {Proceedings of the 25th Annual Boston University Conference on Language Development},
    Editor = {A. H.-J. Do and L. Dom{\'\i}nguez and A. Johansen},
    Pages = {82-93},
    Publisher = {Cascadilla Press},
    Title = {Expletive determiners in child Dutch and Spanish},
    Year = {2001}}

@article{barker1998,
    Author = {Chris Barker},
    Journal = {Natural Language \& Linguistic Theory},
    Pages = {679-717},
    Title = {Partitives, Double Genitives and Anti-Uniqueness},
    Volume = {16},
    Year = {1998}}

@book{Berwick1985,
    Address = {Cambridge, MA},
    Author = {Berwick, Robert C.},
    Publisher = {MIT Press},
    Title = {Acquisition of syntactic knowledge},
    Year = {1985}}

@phdthesis{Carlson1977,
    Author = {Carlson, Gregory N.},
    School = {University of Massachusetts, Amherst},
    Title = {Reference to Kinds in {E}nglish},
    Year = {1977}}

\end{filecontents}

\begin{document}

\chapter{A chapter}
\lipsum
Some text.\cite{Carlson1977}
\lipsum[3]
\cite{Barker1998,Baauw2001}
\begin{figure}[tbp]
\centering
\includegraphics[width=.5\textwidth]{demo.jpg}
\captionof{figure}[A figure from Berwick]{A figure from \protect\cite{Berwick1985}}
\end{figure}
\lipsum[2]
\bibliography{\jobname}
\end{document}

代码部分输出

由于图中的引文是文档源中第四次引用,因此它显示为数字 [4]。但是,由于该图已浮动到页面顶部,因此数字现在显示为乱序。我不使用这种引用样式,但我想知道除了以下两个(非)解决方案之外,是否还有其他方法可以解决这个问题:

  1. 完全避免在标题中使用引用。
  2. 避免对有引用的图形使用浮点数,而使用包\captionof的命令caption(或类似方法)来添加标题。

答案1

我尝试了以下方法,似乎在 MWE 中有效。我不知道在其他文档中会发生什么。

\documentclass[12pt,oneside]{book}
\usepackage[super,sort&compress]{natbib}
\bibpunct{[}{]}{,}{s}{}{} 
\bibliographystyle{unsrtnat}
\usepackage{hyperref}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\usepackage{filecontents}
\usepackage{caption}

\begin{filecontents}{\jobname.bib}
@incollection{Baauw2001,
    Address = {Somerville, MA},
    Author = {Sergio Baauw},
    Booktitle = {Proceedings of the 25th Annual Boston University Conference on Language Development},
    Editor = {A. H.-J. Do and L. Dom{\'\i}nguez and A. Johansen},
    Pages = {82-93},
    Publisher = {Cascadilla Press},
    Title = {Expletive determiners in child Dutch and Spanish},
    Year = {2001}}

@article{barker1998,
    Author = {Chris Barker},
    Journal = {Natural Language \& Linguistic Theory},
    Pages = {679-717},
    Title = {Partitives, Double Genitives and Anti-Uniqueness},
    Volume = {16},
    Year = {1998}}

@book{Berwick1985,
    Address = {Cambridge, MA},
    Author = {Berwick, Robert C.},
    Publisher = {MIT Press},
    Title = {Acquisition of syntactic knowledge},
    Year = {1985}}

@phdthesis{Carlson1977,
    Author = {Carlson, Gregory N.},
    School = {University of Massachusetts, Amherst},
    Title = {Reference to Kinds in {E}nglish},
    Year = {1977}}

\end{filecontents}
\makeatletter
\renewcommand\NAT@sort@cites[1]{%
  \let\NAT@cite@list\@empty
  \@for\@citeb:=#1\do{\expandafter\NAT@star@cite\@citeb\@@}%
  \if@filesw
    \expandafter\write\expandafter\@auxout
      \expandafter{\expandafter\string\expandafter\citation\expandafter{\NAT@cite@list}}%
  \fi
  \@ifnum{\NAT@sort>\z@}{%
    \expandafter\NAT@sort@cites@\expandafter{\NAT@cite@list}%
  }{}%
}%
\makeatother
\begin{document}
\listoffigures
\chapter{A chapter}
\lipsum
Some text.\cite{Carlson1977}
\lipsum[3]
\cite{Barker1998,Baauw2001}
\begin{figure}[tbp]
\centering
\includegraphics[width=.5\textwidth]{demo.jpg}
\caption[A figure from]{A figure from \cite{Berwick1985}}
\end{figure}
\lipsum[2]
\bibliography{\jobname}
\end{document}

相关内容