5

Problem:

Managed to find a solution to cite full references in-text but when I adopt it in my thesis I get two kind of errors.

Minimal Working Example:

\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}

When I try to extract and use the same procedure in my thesis, I get two types of errors:

- thesis.bbl:8: LaTeX Error: Lonely \item--perhaps a missing list environment.
- thesis.bbl:11: Paragraph ended before \BR@c@bibitem was complete.

I am not sure why it says thesis.bbl when it's a .bib file I work with.

Appreciate any guidance in trying to understand why it works in MWE but not in the thesis. Same packages are being used.

UPDATE:

thesis.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}

thesis.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} 
karlkoeller
  • 124,410
kexxcream
  • 2,815

1 Answers1

7

There is a known clash between bibentry and hyperref packages. The latter is loaded by your custom class.

A workaround is to delete the line

\usepackage{bibentry}

from your code and add

\RequirePackage{bibentry}
\makeatletter\let\saved@bibitem\@bibitem\makeatother

just before

\documentclass[twoside,11pt]{Latex/Classes/thesis}

and

\makeatletter\let\@bibitem\saved@bibitem\makeatother

just after. (See https://tex.stackexchange.com/a/65401/27635 for references).

MWE:

\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} 

Output:

enter image description here

karlkoeller
  • 124,410
  • Seems to work with the exception that all other authors last names are being output before the reference. Problem with \nobibliography? – kexxcream Feb 13 '15 at 13:48
  • @kexxcream What does "before the reference" mean? I can see no problems at all... – karlkoeller Feb 13 '15 at 16:28
  • This is how the reference output looks like this: http://jsfiddle.net/3gk37coq/ - the reference (bolded) ends up after all last names. – kexxcream Feb 13 '15 at 16:32
  • @kexxcream And where is the problem? This is the default output with apacite. – karlkoeller Feb 13 '15 at 16:34
  • Well, I wish I could only get the reference and not the last names of all other authors. Is there a way to surpress them? – kexxcream Feb 13 '15 at 16:36
  • @kexxcream I don't think so. Anyway you can ask a follow-up question for that, since it has nothing to do with the original post. And you can accept my answers, if you want, since it solves your question. – karlkoeller Feb 13 '15 at 16:41