问题:
设法找到一种在文中引用完整参考文献的解决方案,但当我在论文中采用它时,出现了两种错误。
最小工作示例:
\documentclass[11pt]{article}
\usepackage{bibentry}
\usepackage{apacite}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{rub14,
author = {Rubin, Jared},
title = {Printing and {Protestants}: An empirical test of the role of printing in the {Reformation}},
journal = {Review of Economics and Statistics},
volume = {96},
number = {2},
pages = {270--286},
year = {2014},
}
\end{filecontents}
\begin{document}
\nobibliography*{}
\bibentry{rub14}
\nocite{*}
\bibliographystyle{apacite}
\bibliography{\jobname}
\end{document}
当我尝试在我的论文中提取并使用相同的程序时,我遇到了两种类型的错误:
- thesis.bbl:8: LaTeX Error: Lonely \item--perhaps a missing list environment.
- thesis.bbl:11: Paragraph ended before \BR@c@bibitem was complete.
我不确定为什么我使用的是一个 .bib 文件,但它却显示 thesis.bbl。
感谢任何指导,试图理解为什么它在 MWE 中有效,但在论文中无效。正在使用相同的包。
更新:
论文.tex
\documentclass[twoside,11pt]{Latex/Classes/thesis}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}
\usepackage{afterpage}
\usepackage{emptypage}
\usepackage{apacite}
\usepackage{bibentry}
\usepackage{notoccite}
\usepackage{url}
\usepackage{etoolbox}
%\usepackage{titletoc}
\usepackage[titles]{tocloft}
\usepackage{caption}
论文.cls
%:-------------------------- book style -----------------------
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions\relax
\LoadClass[a4paper]{book}
%:-------------------------- packages for fancy things -----------------------
\usepackage{mathptmx} % Default font for dissertations is Times.
%\usepackage{fourier} % If mathematics don't display well using Times, then use Fourier.
\usepackage{enumitem}
\usepackage{tabularx,ragged2e,booktabs,caption,tabulary}
\usepackage[flushleft]{threeparttable}
%\usepackage{setspace}
\usepackage{geometry}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{atbegshi}
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage[pdftex]{graphicx} % for improved inclusion of graphics
\usepackage{epstopdf} % converts eps figures to pdf
\usepackage[margin=10pt,font=small,labelfont=bf]{caption} % for improved layout of figure captions with extra margin, smaller font than text
\usepackage{fancyhdr} % for better header layout
\usepackage{eucal}
\usepackage[polutonikogreek,english]{babel}
\usepackage[usenames, dvipsnames]{color}
\usepackage[perpage]{footmisc}
\usepackage{enumerate} % enumerated list for List of Papers
\usepackage{ifthen}
\usepackage{multicol} % for pages with multiple text columns, e.g. References
\setlength{\columnsep}{20pt} % space between columns; default 10pt quite narrow
\usepackage[nottoc]{tocbibind} % correct page numbers for bib in TOC, nottoc suppresses an entry for TOC itself
%\usepackage{nextpage}
\usepackage[T1]{fontenc}
\usepackage{calligra}
%if you use a macTeX 2008 or later, use the ifpdf package
\usepackage{ifpdf}
\usepackage[ pdftex, plainpages = false, pdfpagelabels,
pdfpagelayout = useoutlines,
bookmarks,
bookmarksopen = true,
bookmarksnumbered = true,
breaklinks = true,
linktocpage,
pagebackref = false,
colorlinks = false, % was true
linkcolor = blue,
urlcolor = blue,
citecolor = red,
anchorcolor = green,
hyperindex = true,
hyperfigures
]{hyperref}
答案1
bibentry
和包之间存在已知冲突hyperref
。后者由您的自定义类加载。
解决方法是删除以下行
\usepackage{bibentry}
从您的代码中并添加
\RequirePackage{bibentry}
\makeatletter\let\saved@bibitem\@bibitem\makeatother
就在之前
\documentclass[twoside,11pt]{Latex/Classes/thesis}
和
\makeatletter\let\@bibitem\saved@bibitem\makeatother
之后。(见https://tex.stackexchange.com/a/65401/27635以供参考)。
梅威瑟:
\RequirePackage{bibentry}
\makeatletter\let\saved@bibitem\@bibitem\makeatother
\documentclass[twoside,11pt]{thesis}
\makeatletter\let\@bibitem\saved@bibitem\makeatother
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}
\usepackage{afterpage}
\usepackage{emptypage}
\usepackage{apacite}
\usepackage{notoccite}
\usepackage{url}
\usepackage{etoolbox}
%\usepackage{titletoc}
\usepackage[titles]{tocloft}
\usepackage{caption}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{rub14,
author = {Rubin, Jared},
title = {Printing and {Protestants}: An empirical test of the role of printing in the {Reformation}},
journal = {Review of Economics and Statistics},
volume = {96},
number = {2},
pages = {270--286},
year = {2014},
}
\end{filecontents}
\begin{document}
\nobibliography*{}
\bibentry{rub14}
\nocite{*}
\bibliographystyle{apacite}
\bibliography{\jobname}
\end{document}
输出: