# Two-column endnotes with one-column header

I already did try it some time ago

Endnotes in two columns: how to have \section in one column?

but I was not able to find a solution yet. This is what I am looking for:

Endnotes that are (a) numbered chapter-wise, (b) typeset in two columns, (c) have the chapter-titles as their header, which (d) is typeset in one column.

Here is my example:

\documentclass{book}
\usepackage{enotez,multicol}
\usepackage{kantlipsum,mwe}

\EnotezCurrentSplitTitle
\setenotez{list-name={},
reset = true,
split = chapter,
split-sectioning = {chapter},
split-title={}
}

\begin{document}

\chapter{Erstes Kapitel}
Text\endnote{\kant[1]}. Text\endnote{\kant[2]}.
Text\endnote{\kant[3];\kant[4]}.
Text\endnote{\kant[5];\kant[6]}.

\chapter{Zweites Kapitel}

Text\endnote{\kant[1]}. Text\endnote{\kant[2]}.
Text\endnote{\kant[3];\kant[4]}.
Text\endnote{\kant[5];\kant[6]}.

\newpage

\appendix
\begin{multicols}{2}
\printendnotes
\end{multicols}
\end{document}

\end{document}


I am not stuck with the enotez package. Any help is appreciated. Thank you.

EDIT: I try to show the result:

# Endnotes

1st chapter (heading in one column)

1. Endnote in left column. 2. Endnote in right column.

2nd chapter (heading in one column)

1. Endnote in left column. 2. Endnote in right column.
• When looking for a solution to this I found several severe bugs when typesetting the splitted titles. I will fix them, send the update to CTAN and will post an answer then. – clemens Jun 21 '15 at 22:44
• By “have the chapter-titles as their header” do you mean if you have \chapter{My cool chapter} then you want My cool chapter as heading in the endnotes list, too? – clemens Jun 21 '15 at 23:13
• Yes, it is the heding/title of the chapter in the main text which I want to subdivide the endnotes as well. I edited my question and hope to be more clear now. – michael Jun 22 '15 at 4:23
• The structure is clear. What still isn't clear: enotez would put “Notes for chapter <number>” as headings at each split level. Do you want that or the argument you used as argument for the corresponding \chapter in the document? – clemens Jun 22 '15 at 9:06
• The latter: I want “my cool chapter“ as title of the split. – michael Jun 22 '15 at 13:07

I uploaded v0.8 to CTAN yesterday wich includes the necessary fixes so the \AtEveryEndnotesList, \AtEveryListSplit (and related) hooks work as advertised.

The idea is to use these hooks to begin and end mulicols around the list excluding the headings:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{enotez,multicol}
\usepackage{kantlipsum,microtype}

\setenotez{
reset = true,
split = chapter,
}

\AtEveryEndnotesList{\begin{multicols}{2}} % before the whole list
\AfterEveryEndnotesList{\end{multicols}}   % after the whole list
\AfterEveryListSplit{\begin{multicols}{2}} % after a sub-heading in the splitted list
\AtEveryListSplit{\end{multicols}}         % before a sub-heading in the splitted list

% column sep between columns in a multicols env:
\setlength\columnsep{22pt}

\begin{document}

\chapter{Superduper}
Text\endnote{\kant[1]}. Text\endnote{\kant[2]}.
Text\endnote{\kant[3];\kant[4]}.
Text\endnote{\kant[5];\kant[6]}.

\chapter{Eher langweilig}
Text\endnote{\kant[1]}. Text\endnote{\kant[2]}.
Text\endnote{\kant[3];\kant[4]}.
Text\endnote{\kant[5];\kant[6]}.

\newpage

\appendix
\chapter*{Anmerkungen}
\printendnotes

\end{document}


Getting the actual chapter headings as sub-headings for the list requires more work: we need a package like zref and its titleref module, \labels at every chapter and a possibility to \ref the labels in the sub-headings:

With \usepackage[user,titleref]{zref} we can use \zlabel{<label>} after \chapter's and use\ztitleref{} to get the corresponding chapter-title. In order not have the labels manually all the time we can do something like this:

\usepackage{xparse}
\let\oldchapter\chapter
\RenewDocumentCommand\chapter{som}{%
\IfBooleanTF{#1}
{\oldchapter*{#3}}
{%
\IfNoValueTF{#2}
{\oldchapter{#3}}
{\oldchapter[#2]{#3}}%
\zlabel{ch:\arabic{chapter}}%
}%
}


which places a zlabel ch:<num> every time \chapter is used. With the new \NewSplitTitleTag macro of enotez we can now get the chapter titles as in the subheadings:

\NewSplitTitleTag{chapter title}{\ztitleref{ch:<split-level-id>}}
\setenotez{
reset = true,
split = chapter,
split-title = {<name> <ref>: <chapter title>}
}


The complete code:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{enotez}[2015/06/24]
\usepackage{multicol}
\usepackage{kantlipsum,microtype}

\usepackage[user,titleref]{zref}
\usepackage{xparse}
\let\oldchapter\chapter
\RenewDocumentCommand\chapter{som}{%
\IfBooleanTF{#1}
{\oldchapter*{#3}}
{%
\IfNoValueTF{#2}
{\oldchapter{#3}}
{\oldchapter[#2]{#3}}%
\zlabel{ch:\arabic{chapter}}%
}%
}

\NewSplitTitleTag{chapter title}{\ztitleref{ch:<split-level-id>}}
\setenotez{
reset = true,
split = chapter,
split-title = {<name> <ref>: <chapter title>}
}

\AtEveryEndnotesList{\begin{multicols}{2}} % before the whole list
\AfterEveryEndnotesList{\end{multicols}}   % after the whole list
\AfterEveryListSplit{\begin{multicols}{2}} % after a sub-heading in the splitted list
\AtEveryListSplit{\end{multicols}}         % before a sub-heading in the splitted list

% column sep between columns in a multicols env:
\setlength\columnsep{22pt}

\begin{document}

\chapter{Superduper}
Text\endnote{\kant[1]}. Text\endnote{\kant[2]}.
Text\endnote{\kant[3];\kant[4]}.
Text\endnote{\kant[5];\kant[6]}.

\chapter{Eher langweilig}
Text\endnote{\kant[1]}. Text\endnote{\kant[2]}.
Text\endnote{\kant[3];\kant[4]}.
Text\endnote{\kant[5];\kant[6]}.

\newpage

\appendix
\printendnotes

\end{document}

• I am overwhelmed - will try it out over the weekend. Thank you in advance! – michael Jun 26 '15 at 19:45
• @michael did you test it? – clemens Jun 29 '15 at 19:22
• Not yet, sorry, I'm stuck in steps in between. But I'm trying in one of the next evenings, curious myself. – michael Jun 29 '15 at 20:57
• May there be a incompatibility with SCfigure`? As far as I can see with a quick glance, this is the relevant error I get. More tomorrow evening, I hope. – michael Jun 30 '15 at 20:34
• @michael are you using endnotes in a figure? In a caption maybe? This isn't really supported well. But it isn't part of the question, either, is it? What I am interested in is if my code (as I posted it) works. New problems due to other packages etc. may be worth a new question and new answers. – clemens Jun 30 '15 at 20:42