0

I'm writing my thesis and I want to be able to compile each section individually with the references.

I also want to be able to include the full citation of my papers in the first chapter.

I've achieved this except that it now throws an error:

Cannot be used in preamble. \bibentry{TestEntry}

The file structure is:

Test
├── Ch1
│   └── Ch1.tex
├── example.bib
├── main.tex
└── preamble.tex

The file contents are:

preamble.tex

\usepackage{standalone}
\usepackage{bibentry}
\nobibliography*

\usepackage{import}

main.tex

\documentclass[11pt]{book}

\input{preamble}

\begin{document}
    \title{An Example Document}
    \maketitle

\subimport{Ch1/}{Ch1}

\bibliographystyle{ieeetr}
\bibliography{example}

\end{document}

Ch1/Ch1.tex

%!TeX root = Ch1

\documentclass[crop=false,class=book]{standalone}

\input{../preamble}

\begin{document}

    \chapter{Introduction}

    This citation as cited normally: \cite{TestEntry}   

    And now cited in long form in the text:
    \bibentry{TestEntry}

    \ifstandalone
    % Include the Bibliography
    \bibliographystyle{ieeetr}
    \bibliography{../example}
    \else
    % Do nothing
    \fi

\end{document}

example.bib

@Book{TestEntry,
  title     = {Test Entry},
  publisher = {The University Press},
  year      = {1000},
  author    = {Joesph R Blogs},
  abstract  = {Nothing},
  url       = {http://www.example.com},
}

I came across this question which I think might be relevant:

Are \bibentry and \subfile incompatible? [! LaTeX Error: Cannot be used in preamble.]

but I don't know how to apply it to this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.