A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks
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:
documentclass{book}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
Lorem ipsum
part{Second}
chapter{Two}
Dolor sit amet
appendix
% These two commands do all the job:
addcontentsline{toc}{part}{Appendices}
part*{Appendices}
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
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:
documentclass{book}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
Lorem ipsum
part{Second}
chapter{Two}
Dolor sit amet
appendix
% These two commands do all the job:
addcontentsline{toc}{part}{Appendices}
part*{Appendices}
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
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:
documentclass{book}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
Lorem ipsum
part{Second}
chapter{Two}
Dolor sit amet
appendix
% These two commands do all the job:
addcontentsline{toc}{part}{Appendices}
part*{Appendices}
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
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:
documentclass{book}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
Lorem ipsum
part{Second}
chapter{Two}
Dolor sit amet
appendix
% These two commands do all the job:
addcontentsline{toc}{part}{Appendices}
part*{Appendices}
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
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 5 hours ago
asked 5 hours ago
Taekwondavide
37813
37813
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
documentclass{book}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
Lorem ipsum
part{Second}
chapter{Two}
Dolor sit amet
appendix
% These two commands do all the job:
cleardoublepage
phantomsection
addcontentsline{toc}{part}{Appendices}
part*{Appendices}
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works withbookmark
package.
– Taekwondavide
4 hours ago
1
@Taekwondavide You're welcome!
– samcarter
4 hours ago
add a comment |
The appendix
package with option [toc]
works fine:
documentclass{book}
usepackage{lipsum}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage[toc]{appendix}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
lipsum
part{Second}
chapter{Two}
lipsum
appendix
appendixpage
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
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
4 hours ago
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
documentclass{book}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
Lorem ipsum
part{Second}
chapter{Two}
Dolor sit amet
appendix
% These two commands do all the job:
cleardoublepage
phantomsection
addcontentsline{toc}{part}{Appendices}
part*{Appendices}
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works withbookmark
package.
– Taekwondavide
4 hours ago
1
@Taekwondavide You're welcome!
– samcarter
4 hours ago
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
documentclass{book}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
Lorem ipsum
part{Second}
chapter{Two}
Dolor sit amet
appendix
% These two commands do all the job:
cleardoublepage
phantomsection
addcontentsline{toc}{part}{Appendices}
part*{Appendices}
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works withbookmark
package.
– Taekwondavide
4 hours ago
1
@Taekwondavide You're welcome!
– samcarter
4 hours ago
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
documentclass{book}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
Lorem ipsum
part{Second}
chapter{Two}
Dolor sit amet
appendix
% These two commands do all the job:
cleardoublepage
phantomsection
addcontentsline{toc}{part}{Appendices}
part*{Appendices}
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
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
documentclass{book}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
Lorem ipsum
part{Second}
chapter{Two}
Dolor sit amet
appendix
% These two commands do all the job:
cleardoublepage
phantomsection
addcontentsline{toc}{part}{Appendices}
part*{Appendices}
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
answered 5 hours ago
samcarter
85.5k794273
85.5k794273
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works withbookmark
package.
– Taekwondavide
4 hours ago
1
@Taekwondavide You're welcome!
– samcarter
4 hours ago
add a comment |
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works withbookmark
package.
– Taekwondavide
4 hours ago
1
@Taekwondavide You're welcome!
– samcarter
4 hours ago
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works with
bookmark
package.– Taekwondavide
4 hours ago
A very clean and simple solution, that's exactly what I was looking for, thank you! It also works with
bookmark
package.– Taekwondavide
4 hours ago
1
1
@Taekwondavide You're welcome!
– samcarter
4 hours ago
@Taekwondavide You're welcome!
– samcarter
4 hours ago
add a comment |
The appendix
package with option [toc]
works fine:
documentclass{book}
usepackage{lipsum}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage[toc]{appendix}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
lipsum
part{Second}
chapter{Two}
lipsum
appendix
appendixpage
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
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
4 hours ago
add a comment |
The appendix
package with option [toc]
works fine:
documentclass{book}
usepackage{lipsum}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage[toc]{appendix}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
lipsum
part{Second}
chapter{Two}
lipsum
appendix
appendixpage
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
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
4 hours ago
add a comment |
The appendix
package with option [toc]
works fine:
documentclass{book}
usepackage{lipsum}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage[toc]{appendix}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
lipsum
part{Second}
chapter{Two}
lipsum
appendix
appendixpage
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
The appendix
package with option [toc]
works fine:
documentclass{book}
usepackage{lipsum}
usepackage[nottoc,notlot,notlof]{tocbibind}
usepackage[toc]{appendix}
usepackage{hyperref}
begin{document}
frontmatter
tableofcontents
mainmatter
part{First}
chapter{One}
lipsum
part{Second}
chapter{Two}
lipsum
appendix
appendixpage
chapter{Uno}
First appendix
chapter{Due}
Secondo appendix
end{document}
answered 4 hours ago
Bernard
165k769193
165k769193
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
4 hours ago
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
4 hours ago
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
4 hours ago
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
4 hours ago
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