插入參考書目的問題

插入參考書目的問題

我正在嘗試使用 achemso 套件作為我的參考書目,但我的參考文獻有問題。但我無法在生成的 pdf 中看到任何內容。這是我用的包

\begin{filecontents}{\jobname.bib}% and this is my bib file
@article{1,
  title={Resistance of Neisseria gonorrhoeae to antimicrobial hydrophobic agents is modulated by the mtrRCDE efflux system},
  author={Hagman, Kayla E and Pan, Wubin and Spratt, Brian G and Balthazar, Jacqueline T and Judd, Ralph C and Shafer, William M},
  journal={Microbiology},
  volume={141},
  number={3},
  pages={611--622},
  year={1995},
  publisher={Microbiology Society}
}
\end{filecontents}
\documentclass[journal=jacsat, layout=singlecolumn]{achemso}
\setkeys{acs}{articletitle=true}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{xkeyval}
\usepackage{cite}
\usepackage{amstext}
\usepackage{csvsimple}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{refstyle}
\usepackage{amstext}
\usepackage{gensymb}
\usepackage{upgreek}
\usepackage{natmove}
\usepackage{natbib}
\usepackage{array}
\title{title}
\begin{document}

\bibliographystyle{achemso}
\bibliography{\jobname}

\end{document}

有人可以建議可能是什麼問題嗎?謝謝

答案1

坦白說,你的序言一團糟。我強烈懷疑您實際上並不知道為什麼要加載 MWE 中包含的至少一半的軟體包(無論如何它們都不相關)。這很重要,因為在這種情況下,錯誤、神秘的怪異和其他陰暗而令人沮喪的事件往往會發生。

您沒有提到編譯錯誤,這很奇怪,因為即使進行了明顯的更正,我也無法在沒有錯誤的情況下編譯您的程式碼。所以我不確定這是否有幫助,因為我不確定我是否重現了您遇到的問題。即使沒有,你也應該清理序言。

以下是一些一般準則:

  • 根據需要加載盡可能多的包不再有;
  • 如果不確定是否需要某個包,註解掉載入和測試;
  • 永遠不要加載一個包兩次;
  • 不加載由其他包加載的包,至少當這種關係是第一個包存在的理由時,例如amstext與恰恰不同amsmath,因為您可能想使用前者而不使用後者 - 加載時它沒有任何作用後者(與amsfonts和類似amssymb);
  • 如果該類別載入了提供文檔類別的套件(在 CTAN 意義上),則不要載入這些套件的一部分 ( natmove);
  • 絕不如果你的類別的文檔告訴你,載入包修改這些包的行為 ( natbib);
  • 不要載入試圖執行相同操作或精確控製文件相同方面的包,除非您確信它們是相容的 - 如果出現奇怪情況,請將這些包放在您的可疑列表中的較高位置(、achemso.clscite.sty等) 。natmove.stynatbib.sty

讀取控制台輸出。警告和錯誤旨在為您提供有關錯誤的資訊。他們並不總是做得很好,但有時他們會做得很好。例如,一個錯誤告訴我不要\bibliographystyle{}在文件中使用。解釋該訊息不需要特定的 TeX 或 LaTeX 知識。錯誤也顯示了natmove.sty和的問題cite.sty,但這些問題需要更多的經驗來解釋。但文件 ( texdoc natmove) 用非常簡單的術語告訴了我很多資訊:例如,它achemso會修改natbib,並且可能需要調整您的.bib文件以獲得最佳結果。我推薦它。

我在下面評論了我對 MWE 的修改。結果產生

參考書目

\begin{filecontents}{\jobname.bib}
@article{hagman1995,
  title={Resistance of Neisseria gonorrhoeae to antimicrobial hydrophobic agents is modulated by the mtrRCDE efflux system},
  author={Hagman, Kayla E and Pan, Wubin and Spratt, Brian G and Balthazar, Jacqueline T and Judd, Ralph C and Shafer, William M},
  journal={Microbiology},
  volume={141},
  number={3},
  pages={611--622},
  year={1995},
  publisher={Microbiology Society}
}
\end{filecontents}
\documentclass[journal=jacsat, layout=singlecolumn]{achemso}% loads natbib, natmove
\setkeys{acs}{articletitle=true}
\usepackage[latin1]{inputenc}% are you really using latin1 input encoding? why? consider switching to utf8.... - not relevant for MWE
\usepackage[english]{babel}% better to specify the variant e.g. british - not relevant for MWE - also there's a weird interaction such that \cite cannot be the first thing in the document if this is loaded (but it is fine otherwise)
% \usepackage{xkeyval}% why are you loading this in a document?
% don't load cite - use achemso's facilities
\usepackage{csvsimple}% not relevant for MWE
\usepackage{amsmath}% includes amstext - not relevant for MWE
\usepackage{amssymb}% includes amsfonts - not relevant for MWE
\usepackage{graphicx}% not relevant for MWE
\usepackage{refstyle}% not relevant for MWE
\usepackage{gensymb}% not relevant for MWE
\usepackage{upgreek}% not relevant for MWE
\usepackage{array}% not relevant for MWE
\usepackage{hyperref}% should be loaded LATE - only packages which you know require later loading should be loaded later - not relevant for MWE

\title{title}% required for MWE
\begin{document}

  Some content\cite{hagman1995}% don't use bibkeys such as '1' but something meaningful; 'Some content' added for compatibility with use of babel (see above)

% don't specify another bibstyle command - the class already does this
\bibliography{\jobname}

\end{document}

相關內容