我正在使用该bibentry
包将我的 bibitems 插入 CV 而不打印参考书目。这很好,直到我加载hyperref
。然后我收到错误消息Lonely \item--perhaps a missing list environment
。应该有一个解决方法(看这里),我在下面的代码中将其作为停用项包括在内。使用它时,我仍然收到错误消息。还有其他解决方案吗(请不要使用 biblatex)还是我没有正确使用解决方法?
\begin{filecontents}{\jobname.bib}
@Book{elvis,
author = "Elvis Presley",
title = "Turn Me One More Time",
publisher = "Jail House Books",
year = 1963,
}
\end{filecontents}
\documentclass{article}
%\makeatletter
%\let\saved@bibitem\@bibitem
%\makeatother
\usepackage{bibentry}
\nobibliography*
\usepackage{hyperref}
\begin{document}
\bibentry{elvis}
%\bibliographystyle{plain} % works fine
\bibliographystyle{elsart-harv} % gives an error
\nobibliography{\jobname} % comment out when using the workaround
%\begingroup
%\makeatletter
%\let\@bibitem\saved@bibitem
%\nobibliography{\jobname}
%\endgroup
\end{document}
编辑:事实证明,问题不仅仅在于bibentry
和hyperref
。为了方便起见,我替换了我的实际围兜风格elsart-harv和plain
。我没有想到风格会是这件事的关键,但显然它就是。
答案1
这看起来更简单:
\begin{filecontents}{\jobname.bib}
@Book{elvis,
author = "Elvis Presley",
title = "Turn Me One More Time",
publisher = "Jail House Books",
year = 1963,
}
\end{filecontents}
\documentclass{article}
\bibliographystyle{plain}
\usepackage{bibentry}
\makeatletter\let\saved@bibitem\@bibitem\makeatother
\usepackage{hyperref}
\makeatletter\let\@bibitem\saved@bibitem\makeatother
\begin{document}
\nobibliography*
\bibentry{elvis}
\nobibliography{\jobname}
\end{document}
下面展示了如何集成elsarticle-harv.bst
\begin{filecontents}{\jobname.bib}
@Book{elvis,
author = "Elvis Presley",
title = "Turn Me One More Time",
publisher = "Jail House Books",
year = 1963,
}
\end{filecontents}
\documentclass{article}
\usepackage{natbib}
\bibliographystyle{elsarticle-harv}
\usepackage{bibentry}
\makeatletter\let\saved@bibitem\@bibitem\makeatother
\usepackage{hyperref}
\makeatletter\let\@bibitem\saved@bibitem\makeatother
\begin{document}
\nobibliography*
\bibentry{elvis}
\nobibliography{\jobname} % comment out when using the workaround
\end{document}