Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new command that switches between chapter abbreviation and Appendix, use it in toc #316

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/dndtoc.sty
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
\titlecontents{chapter}
[0pt] % left
{ \addvspace{.1in} \DndFontTocChapter } % above-code
{\tocchapterabbreviationname\ \thecontentslabel :~ } % numbered-entry-format
{ \tocchapapp\ \thecontentslabel :~ } % numbered-entry-format
{} % numberless-entry-format
{\titlerule*{.}\contentspage} % filler-page-format

Expand All @@ -28,4 +28,10 @@
{\thecontentslabel :~ } % numbered-entry-format
{} % numberless-entry-format
{\titlerule*{.}\contentspage} % filler-page-format

\newcommand\tocchapapp{\tocchapterabbreviationname}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously, feel free to give this another name.

\g@addto@macro\appendix{%
\addtocontents{toc}{\protect\renewcommand{\protect\@chapapp}{\appendixname}}%
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not strictly necessary, but it allows people to use \@chapapp and \chaptertitlename in their TOC, should they ever whish to do so.

The behaviour without this line is that \@chapapp is always Chapter in that context, which tripped me up at first.

\addtocontents{toc}{\protect\renewcommand{\protect\tocchapapp}{\appendixname}}%
}
}