A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Clash Royale CLAN TAG#URR8PPP
I found a lot of questions abount appendices and ToC. Many users want appendices to be grouped in an Appendix part, however some problems arise with ToC, hyperref, PDF viewer bookmarks, and so on.
There are different solutions which require extra packages, command patching and other extra code, however none of them satisfies me. I almost found an easy way to accomplish a good result, where appendices are added to bookmarks in the right way and hyperref links point to the right page. However, the number of the "Appendix" part page is wrong (it's the number of appendix A). Is there any EASY way to fix that?
This is a MWE:
documentclassbook
usepackage[nottoc,notlot,notlof]tocbibind
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
Lorem ipsum
partSecond
chapterTwo
Dolor sit amet
appendix
% These two commands do all the job:
addcontentslinetocpartAppendices
part*Appendices
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument
This is the ToC (with links pointing to the right page)
I First 1
1 One 3
II Second 5
2 Two 7
Appendices 11 (this should be 9)
A Uno 11
B Due 13
Using bookmark package instead of (in addition to) hyperref make it worse (Appendix link and ToC page will point to chapter "Two"). Switching addcontentsline and part* doesn't solve the problem.
EDIT: for some reasons, I do not want to use appendix package
table-of-contents hyperref appendices
add a comment |
I found a lot of questions abount appendices and ToC. Many users want appendices to be grouped in an Appendix part, however some problems arise with ToC, hyperref, PDF viewer bookmarks, and so on.
There are different solutions which require extra packages, command patching and other extra code, however none of them satisfies me. I almost found an easy way to accomplish a good result, where appendices are added to bookmarks in the right way and hyperref links point to the right page. However, the number of the "Appendix" part page is wrong (it's the number of appendix A). Is there any EASY way to fix that?
This is a MWE:
documentclassbook
usepackage[nottoc,notlot,notlof]tocbibind
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
Lorem ipsum
partSecond
chapterTwo
Dolor sit amet
appendix
% These two commands do all the job:
addcontentslinetocpartAppendices
part*Appendices
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument
This is the ToC (with links pointing to the right page)
I First 1
1 One 3
II Second 5
2 Two 7
Appendices 11 (this should be 9)
A Uno 11
B Due 13
Using bookmark package instead of (in addition to) hyperref make it worse (Appendix link and ToC page will point to chapter "Two"). Switching addcontentsline and part* doesn't solve the problem.
EDIT: for some reasons, I do not want to use appendix package
table-of-contents hyperref appendices
add a comment |
I found a lot of questions abount appendices and ToC. Many users want appendices to be grouped in an Appendix part, however some problems arise with ToC, hyperref, PDF viewer bookmarks, and so on.
There are different solutions which require extra packages, command patching and other extra code, however none of them satisfies me. I almost found an easy way to accomplish a good result, where appendices are added to bookmarks in the right way and hyperref links point to the right page. However, the number of the "Appendix" part page is wrong (it's the number of appendix A). Is there any EASY way to fix that?
This is a MWE:
documentclassbook
usepackage[nottoc,notlot,notlof]tocbibind
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
Lorem ipsum
partSecond
chapterTwo
Dolor sit amet
appendix
% These two commands do all the job:
addcontentslinetocpartAppendices
part*Appendices
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument
This is the ToC (with links pointing to the right page)
I First 1
1 One 3
II Second 5
2 Two 7
Appendices 11 (this should be 9)
A Uno 11
B Due 13
Using bookmark package instead of (in addition to) hyperref make it worse (Appendix link and ToC page will point to chapter "Two"). Switching addcontentsline and part* doesn't solve the problem.
EDIT: for some reasons, I do not want to use appendix package
table-of-contents hyperref appendices
I found a lot of questions abount appendices and ToC. Many users want appendices to be grouped in an Appendix part, however some problems arise with ToC, hyperref, PDF viewer bookmarks, and so on.
There are different solutions which require extra packages, command patching and other extra code, however none of them satisfies me. I almost found an easy way to accomplish a good result, where appendices are added to bookmarks in the right way and hyperref links point to the right page. However, the number of the "Appendix" part page is wrong (it's the number of appendix A). Is there any EASY way to fix that?
This is a MWE:
documentclassbook
usepackage[nottoc,notlot,notlof]tocbibind
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
Lorem ipsum
partSecond
chapterTwo
Dolor sit amet
appendix
% These two commands do all the job:
addcontentslinetocpartAppendices
part*Appendices
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument
This is the ToC (with links pointing to the right page)
I First 1
1 One 3
II Second 5
2 Two 7
Appendices 11 (this should be 9)
A Uno 11
B Due 13
Using bookmark package instead of (in addition to) hyperref make it worse (Appendix link and ToC page will point to chapter "Two"). Switching addcontentsline and part* doesn't solve the problem.
EDIT: for some reasons, I do not want to use appendix package
table-of-contents hyperref appendices
table-of-contents hyperref appendices
edited Dec 26 '18 at 23:22
Taekwondavide
asked Dec 26 '18 at 23:15
TaekwondavideTaekwondavide
38313
38313
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can provide a suitable target for the hyperlink by introducing a phantomsection. To ensure that this link to the correct page, use if after cleardoubelpage
documentclassbook
usepackage[nottoc,notlot,notlof]tocbibind
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
Lorem ipsum
partSecond
chapterTwo
Dolor sit amet
appendix
% These two commands do all the job:
cleardoublepage
phantomsection
addcontentslinetocpartAppendices
part*Appendices
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument

A very clean and simple solution, that's exactly what I was looking for, thank you! It also works withbookmarkpackage.
– Taekwondavide
Dec 26 '18 at 23:40
1
@Taekwondavide You're welcome!
– samcarter
Dec 26 '18 at 23:41
add a comment |
The appendix package with option [toc]works fine:
documentclassbook
usepackagelipsum
usepackage[nottoc,notlot,notlof]tocbibind
usepackage[toc]appendix
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
lipsum
partSecond
chapterTwo
lipsum
appendix
appendixpage
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument

Thank you, I already knew this package, however for some reasons (such as the fact that it messes up TeXstudio structure tree) I prefer not to use it. Also, I was looking for a more general solution that may apply to other situations too (not only the appendix).
– Taekwondavide
Dec 26 '18 at 23:52
@Taekwondavide Have you contacted theappendixpackage maintainer about this?
– Peter Wilson
Dec 27 '18 at 20:23
@PeterWilson I badly explained myself. Appendix package works fine, but TeXstudio doesn't recognizeappendixpageas a new part of the document, which causes all appendices to be seen seen by the editor as chapters of the lastpartin the main matter, which is quite annoying for me as I'm using TeXstudio's structure tree a lot (this is not the only reason I want to fix my code without additional packages). However, the bookmark tree in PDF viewer is correct and appendices are seen as a part.
– Taekwondavide
Dec 28 '18 at 2:52
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f467460%2fa-clean-and-simple-way-to-add-appendices-to-table-of-contents-and-bookmarks%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can provide a suitable target for the hyperlink by introducing a phantomsection. To ensure that this link to the correct page, use if after cleardoubelpage
documentclassbook
usepackage[nottoc,notlot,notlof]tocbibind
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
Lorem ipsum
partSecond
chapterTwo
Dolor sit amet
appendix
% These two commands do all the job:
cleardoublepage
phantomsection
addcontentslinetocpartAppendices
part*Appendices
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument

A very clean and simple solution, that's exactly what I was looking for, thank you! It also works withbookmarkpackage.
– Taekwondavide
Dec 26 '18 at 23:40
1
@Taekwondavide You're welcome!
– samcarter
Dec 26 '18 at 23:41
add a comment |
You can provide a suitable target for the hyperlink by introducing a phantomsection. To ensure that this link to the correct page, use if after cleardoubelpage
documentclassbook
usepackage[nottoc,notlot,notlof]tocbibind
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
Lorem ipsum
partSecond
chapterTwo
Dolor sit amet
appendix
% These two commands do all the job:
cleardoublepage
phantomsection
addcontentslinetocpartAppendices
part*Appendices
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument

A very clean and simple solution, that's exactly what I was looking for, thank you! It also works withbookmarkpackage.
– Taekwondavide
Dec 26 '18 at 23:40
1
@Taekwondavide You're welcome!
– samcarter
Dec 26 '18 at 23:41
add a comment |
You can provide a suitable target for the hyperlink by introducing a phantomsection. To ensure that this link to the correct page, use if after cleardoubelpage
documentclassbook
usepackage[nottoc,notlot,notlof]tocbibind
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
Lorem ipsum
partSecond
chapterTwo
Dolor sit amet
appendix
% These two commands do all the job:
cleardoublepage
phantomsection
addcontentslinetocpartAppendices
part*Appendices
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument

You can provide a suitable target for the hyperlink by introducing a phantomsection. To ensure that this link to the correct page, use if after cleardoubelpage
documentclassbook
usepackage[nottoc,notlot,notlof]tocbibind
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
Lorem ipsum
partSecond
chapterTwo
Dolor sit amet
appendix
% These two commands do all the job:
cleardoublepage
phantomsection
addcontentslinetocpartAppendices
part*Appendices
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument

answered Dec 26 '18 at 23:27
samcartersamcarter
86.4k795276
86.4k795276
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works withbookmarkpackage.
– Taekwondavide
Dec 26 '18 at 23:40
1
@Taekwondavide You're welcome!
– samcarter
Dec 26 '18 at 23:41
add a comment |
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works withbookmarkpackage.
– Taekwondavide
Dec 26 '18 at 23:40
1
@Taekwondavide You're welcome!
– samcarter
Dec 26 '18 at 23:41
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works with
bookmark package.– Taekwondavide
Dec 26 '18 at 23:40
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works with
bookmark package.– Taekwondavide
Dec 26 '18 at 23:40
1
1
@Taekwondavide You're welcome!
– samcarter
Dec 26 '18 at 23:41
@Taekwondavide You're welcome!
– samcarter
Dec 26 '18 at 23:41
add a comment |
The appendix package with option [toc]works fine:
documentclassbook
usepackagelipsum
usepackage[nottoc,notlot,notlof]tocbibind
usepackage[toc]appendix
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
lipsum
partSecond
chapterTwo
lipsum
appendix
appendixpage
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument

Thank you, I already knew this package, however for some reasons (such as the fact that it messes up TeXstudio structure tree) I prefer not to use it. Also, I was looking for a more general solution that may apply to other situations too (not only the appendix).
– Taekwondavide
Dec 26 '18 at 23:52
@Taekwondavide Have you contacted theappendixpackage maintainer about this?
– Peter Wilson
Dec 27 '18 at 20:23
@PeterWilson I badly explained myself. Appendix package works fine, but TeXstudio doesn't recognizeappendixpageas a new part of the document, which causes all appendices to be seen seen by the editor as chapters of the lastpartin the main matter, which is quite annoying for me as I'm using TeXstudio's structure tree a lot (this is not the only reason I want to fix my code without additional packages). However, the bookmark tree in PDF viewer is correct and appendices are seen as a part.
– Taekwondavide
Dec 28 '18 at 2:52
add a comment |
The appendix package with option [toc]works fine:
documentclassbook
usepackagelipsum
usepackage[nottoc,notlot,notlof]tocbibind
usepackage[toc]appendix
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
lipsum
partSecond
chapterTwo
lipsum
appendix
appendixpage
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument

Thank you, I already knew this package, however for some reasons (such as the fact that it messes up TeXstudio structure tree) I prefer not to use it. Also, I was looking for a more general solution that may apply to other situations too (not only the appendix).
– Taekwondavide
Dec 26 '18 at 23:52
@Taekwondavide Have you contacted theappendixpackage maintainer about this?
– Peter Wilson
Dec 27 '18 at 20:23
@PeterWilson I badly explained myself. Appendix package works fine, but TeXstudio doesn't recognizeappendixpageas a new part of the document, which causes all appendices to be seen seen by the editor as chapters of the lastpartin the main matter, which is quite annoying for me as I'm using TeXstudio's structure tree a lot (this is not the only reason I want to fix my code without additional packages). However, the bookmark tree in PDF viewer is correct and appendices are seen as a part.
– Taekwondavide
Dec 28 '18 at 2:52
add a comment |
The appendix package with option [toc]works fine:
documentclassbook
usepackagelipsum
usepackage[nottoc,notlot,notlof]tocbibind
usepackage[toc]appendix
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
lipsum
partSecond
chapterTwo
lipsum
appendix
appendixpage
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument

The appendix package with option [toc]works fine:
documentclassbook
usepackagelipsum
usepackage[nottoc,notlot,notlof]tocbibind
usepackage[toc]appendix
usepackagehyperref
begindocument
frontmatter
tableofcontents
mainmatter
partFirst
chapterOne
lipsum
partSecond
chapterTwo
lipsum
appendix
appendixpage
chapterUno
First appendix
chapterDue
Secondo appendix
enddocument

answered Dec 26 '18 at 23:39
BernardBernard
166k769194
166k769194
Thank you, I already knew this package, however for some reasons (such as the fact that it messes up TeXstudio structure tree) I prefer not to use it. Also, I was looking for a more general solution that may apply to other situations too (not only the appendix).
– Taekwondavide
Dec 26 '18 at 23:52
@Taekwondavide Have you contacted theappendixpackage maintainer about this?
– Peter Wilson
Dec 27 '18 at 20:23
@PeterWilson I badly explained myself. Appendix package works fine, but TeXstudio doesn't recognizeappendixpageas a new part of the document, which causes all appendices to be seen seen by the editor as chapters of the lastpartin the main matter, which is quite annoying for me as I'm using TeXstudio's structure tree a lot (this is not the only reason I want to fix my code without additional packages). However, the bookmark tree in PDF viewer is correct and appendices are seen as a part.
– Taekwondavide
Dec 28 '18 at 2:52
add a comment |
Thank you, I already knew this package, however for some reasons (such as the fact that it messes up TeXstudio structure tree) I prefer not to use it. Also, I was looking for a more general solution that may apply to other situations too (not only the appendix).
– Taekwondavide
Dec 26 '18 at 23:52
@Taekwondavide Have you contacted theappendixpackage maintainer about this?
– Peter Wilson
Dec 27 '18 at 20:23
@PeterWilson I badly explained myself. Appendix package works fine, but TeXstudio doesn't recognizeappendixpageas a new part of the document, which causes all appendices to be seen seen by the editor as chapters of the lastpartin the main matter, which is quite annoying for me as I'm using TeXstudio's structure tree a lot (this is not the only reason I want to fix my code without additional packages). However, the bookmark tree in PDF viewer is correct and appendices are seen as a part.
– Taekwondavide
Dec 28 '18 at 2:52
Thank you, I already knew this package, however for some reasons (such as the fact that it messes up TeXstudio structure tree) I prefer not to use it. Also, I was looking for a more general solution that may apply to other situations too (not only the appendix).
– Taekwondavide
Dec 26 '18 at 23:52
Thank you, I already knew this package, however for some reasons (such as the fact that it messes up TeXstudio structure tree) I prefer not to use it. Also, I was looking for a more general solution that may apply to other situations too (not only the appendix).
– Taekwondavide
Dec 26 '18 at 23:52
@Taekwondavide Have you contacted the
appendix package maintainer about this?– Peter Wilson
Dec 27 '18 at 20:23
@Taekwondavide Have you contacted the
appendix package maintainer about this?– Peter Wilson
Dec 27 '18 at 20:23
@PeterWilson I badly explained myself. Appendix package works fine, but TeXstudio doesn't recognize
appendixpage as a new part of the document, which causes all appendices to be seen seen by the editor as chapters of the last part in the main matter, which is quite annoying for me as I'm using TeXstudio's structure tree a lot (this is not the only reason I want to fix my code without additional packages). However, the bookmark tree in PDF viewer is correct and appendices are seen as a part.– Taekwondavide
Dec 28 '18 at 2:52
@PeterWilson I badly explained myself. Appendix package works fine, but TeXstudio doesn't recognize
appendixpage as a new part of the document, which causes all appendices to be seen seen by the editor as chapters of the last part in the main matter, which is quite annoying for me as I'm using TeXstudio's structure tree a lot (this is not the only reason I want to fix my code without additional packages). However, the bookmark tree in PDF viewer is correct and appendices are seen as a part.– Taekwondavide
Dec 28 '18 at 2:52
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f467460%2fa-clean-and-simple-way-to-add-appendices-to-table-of-contents-and-bookmarks%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown