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












0














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










share|improve this question





























    0














    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










    share|improve this question



























      0












      0








      0







      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










      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 6 mins ago

























      asked 13 mins ago









      Taekwondavide

      36113




      36113






















          1 Answer
          1






          active

          oldest

          votes


















          0














          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}




          share





















            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
            });


            }
            });














            draft saved

            draft discarded


















            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

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            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}




            share


























              0














              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}




              share
























                0












                0








                0






                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}




                share












                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}





                share











                share


                share










                answered 1 min ago









                samcarter

                85.4k794273




                85.4k794273






























                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Calculate evaluation metrics using cross_val_predict sklearn

                    Insert data from modal to MySQL (multiple modal on website)