使用 Chapterbib 消除了 achemso 套件的選項

使用 Chapterbib 消除了 achemso 套件的選項

我正在嘗試使用 achemso 套件來格式化我的參考書目,同時也使用chapterbib 為每個章節提供單獨的參考書目。我這樣載入兩個包

\usepackage[sectionbib]{chapterbib} \usepackage[articletitle=true,etalmode=truncate,maxauthors=5,biblabel=fullstop,doi=true]{achemso}

我對每個單獨的章節都使用 include

\include{Chapters/Chapter1}

在每一章中我都會使用以下內容來製作參考書目

\bibliographystyle{achemso}

\bibliography{All_References}

其中 All-References 包含 bibtex 參考書目條目。當我這樣做時,文檔會編譯並且看起來不錯,但是加載 achemso 包時包含的選項將被忽略。但是,如果我註解掉 Chapterbib 命令,則會遵循選項,但是我沒有獲得每章的參考書目。

微量元素:

主要.tex:

\usepackage[utf8]{inputenc}
%\usepackage[sectionbib]{chapterbib}
\usepackage[articletitle=true,etalmode=truncate,maxauthors=5,biblabel=fullstop,doi=true]{achemso} 
\begin{document}
\include{Section}
\end{document}

節.tex:

Something\cite{VanOrden2015}

\section{References}
\bibliographystyle{achemso}
\bibliography{References}

參考文獻.bib:

@article{VanOrden2015,
author = {Melnykov, Artem V. and Nayak, Rajesh K. and Hall, Kathleen B. and Van Orden, Alan},
title = {Effect of Loop Composition on the Stability and Folding Kinetics of RNA Hairpins with Large Loops},
journal = {Biochemistry},
volume = {54},
number = {10},
pages = {1886-1896},
year = {2015},
doi = {10.1021/bi5014276},
PMID= {25697574},
URL = { 
        https://doi.org/10.1021/bi5014276
},
eprint = { 
        https://doi.org/10.1021/bi5014276
}
}

請注意,註解掉和取消註解 main.tex 檔案中的第二行會變更參考書目的顯示方式(當第二行出現時,DOI 會消失)

答案1

achemso使用非常聰明的方式將選項傳遞給參考書目風格:它將所有選項放入一個.bib名為的內部條目中achemso-control,該條目會被包自動引用achemso。這允許您透過文件中的套件選項控制參考書目樣式的行為.tex

如果您使用,chapterbib則必須手動引用此條目。最簡單的方法是將 put\nocite{achemso-control}放在每個 的開頭\chapter

但為了避免虛假警告,我們需要稍微複雜的方法。定義

\makeatletter
\newcommand*{\achemsocontrolbib}{%
  \immediate\write\@auxout{%
    \string\citation\string{achemso-control\string}%
  }}
\makeatother

並在每章的開頭調用它。

這是一個獨立的範例文件,其中包含兩章的文件和一個.bib範例。

\documentclass{report}
\usepackage[sectionbib]{chapterbib}
\usepackage[biblabel=fullstop,
            etalmode=truncate,maxauthors=5,
            articletitle=true,doi=true]{achemso}

\makeatletter
\newcommand*{\achemsocontrolbib}{%
  \immediate\write\@auxout{%
    \string\citation\string{achemso-control\string}%
  }}
\makeatother

% chapter 1
\begin{filecontents}{\jobname-1.tex}
\achemsocontrolbib
\chapter{One}
Something\cite{VanOrden2015}

\bibliographystyle{achemso}
\bibliography{\jobname}
\end{filecontents}

% chapter 2
\begin{filecontents}{\jobname-2.tex}
\achemsocontrolbib
\chapter{Two}
Something else\cite{VanOrden2015,sigfridsson}

\bibliographystyle{achemso}
\bibliography{\jobname}
\end{filecontents}

% bib file
\begin{filecontents}{\jobname.bib}
@article{VanOrden2015,
  author  = {Melnykov, Artem V. and Nayak, Rajesh K.
             and Hall, Kathleen B. and Van Orden, Alan},
  title   = {Effect of Loop Composition on the Stability
             and Folding Kinetics of {RNA} Hairpins with Large Loops},
  journal = {Biochemistry},
  volume  = {54},
  number  = {10},
  pages   = {1886-1896},
  year    = {2015},
  doi     = {10.1021/bi5014276},
  PMID    = {25697574},
}
@article{sigfridsson,
  author       = {Sigfridsson, Emma and Ryde, Ulf},
  title        = {Comparison of Methods for Deriving Atomic Charges from the
                  Electrostatic Potential and Moments},
  journal      = {Journal of Computational Chemistry},
  year         = 1998,
  volume       = 19,
  number       = 4,
  pages        = {377-395},
  doi          = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}
\end{filecontents}

\begin{document}
\include{\jobname-1}
\include{\jobname-2}
\end{document}

第2章參考書目

相關內容