# How to print endnotes on the same page after the end of the related section in enotez pkg

I need to print the endnotes created with enotez package to be printed not on a new page but on the same page where the last line of the chapter is printed. (I use enotez with reset option for creating seperate end notes for each chapter.)

\documentclass{book}
\usepackage[reset=true]{enotez}
\begin{document}
Near the beginning of his career, Einstein thought that Newtonian mechanics was no longer enough to reconcile the laws of classical mechanics with the laws of the electromagnetic field. This led to the development of his special theory of relativity. He realized, however, that the principle of relativity could also be extended to gravitational fields, and with his subsequent theory of gravitation in 1916, he published a paper on general relativity. He continued to deal with problems of statistical mechanics and quantum theory, which led to his explanations of particle theory and the motion of molecules. He also investigated the thermal properties of light which laid the foundation of the photon theory of light. In 1917, Einstein applied the general theory of relativity to model the
large-scale structure of the universe.\endnote{This text is from the wikipedia}
\printendnotes
\end{document}


Like the image below.

Now not only it goes to a new page but where it is on the even page it leaves a blank page and goes to a new odd page for the beginning of the Notes.

• I looked into the enotez documentation but I couldn't find any option controlling the begining of the Notes box. – nima Jan 26 '16 at 13:41
• Your MWE produces (after removing the space after article in {article }) exactly your desired output -- so not sure what you want. The pagination will be determined by the header type assigned to the header, and how that header behaves in your document. – Aubrey Blumsohn Jan 26 '16 at 15:12
• @AubreyBlumsohn You are right. that's my fault. Out of hesitation and convenience I didn't use the actual class for my MWE. I use enotez with book class. So I'll edit the above code. – nima Jan 26 '16 at 15:26
• @AubreyBlumsohn And I shall compile my MWE from now on to see if the desired "erroneous" environment is reproduced or not. – nima Jan 26 '16 at 15:31

When you use a class that has a \chapter command then per default enotez uses \chapter* for the heading of the list. And as you're probably aware of \chapter calls \clearpage which explains the new page.

This is explained in the option section of enotez' documentation:

• list-heading = {<sectioning command including argument>}

You can use this option to manually set the list heading command, e.g., list-heading = {\chapter{#1}} for a numbered heading. The default depends upon if the class you’re using provides \chapter or not. It either uses \chapter* or \section*. You can see that you have to refer to the actual heading with #1.

The solution:

\documentclass{book}
\usepackage{enotez}

\setenotez{
reset = true ,
}

\begin{document}

Near the beginning of his career, Einstein thought that Newtonian mechanics
was no longer enough to reconcile the laws of classical mechanics with the
laws of the electromagnetic field. This led to the development of his special
theory of relativity. He realized, however, that the principle of relativity
could also be extended to gravitational fields, and with his subsequent theory
of gravitation in 1916, he published a paper on general relativity. He
continued to deal with problems of statistical mechanics and quantum theory,
which led to his explanations of particle theory and the motion of
molecules. He also investigated the thermal properties of light which laid the
foundation of the photon theory of light. In 1917, Einstein applied the
general theory of relativity to model the large-scale structure of the
universe.\endnote{This text is from the wikipedia}

\printendnotes

\end{document}