Here is a small MWE that I suspect may contain one the necessary definitions that may be missing in your code.
\begin{filecontents}{mytestbib.bib}
@book{goossens93,
author = "Frank Mittelbach and Michel Goossens and Johannes Braams and David Carlisle and Chris Rowley",
title = "The {LaTeX} Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
\end{filecontents}
\documentclass{report}
\usepackage{filecontents}
\usepackage{lipsum}
\usepackage[numbers,square,comma,sort&compress]{natbib}
\usepackage{bibunits}
\defaultbibliography{mytestbib}
\defaultbibliographystyle{IEEEtranN}
\renewcommand{\bibname}{References}
%\nocite{*} % list all refs in database, cited or not
\begin{document}
\chapter{Example}
\renewcommand{\bibsection}{\section*{\bibname}\markboth{\leftmark}{\bibname}}
\begin{bibunit}
\section{A section}
There is text in a section, \lipsum and sometimes a reference is needed \cite{goossens93}
\putbib
\end{bibunit}
\begin{bibunit}
\section{A second section}
There is text in a section, \lipsum and sometimes a reference is needed \cite{goossens93} \lipsum
\putbib
\end{bibunit}
\end{document}
I prefer to compile the code with command line tools. If you are on windows leave me a comment and I can provide some command line instructions for MikTeX
specific to xelatex
and bibunits
.
\documentclass{...}
and ending with\end{document}
.