Problem on position of bookmarks in PDF












3














I am writing a book that has 3 parts and each part has many sections. After compiling the .tex file, some of the bookmarks of the .pdf file are misplaced as shown in below:



enter image description here



and its MWE



documentclass[12pt,a4paper]{book}
usepackage{hyperref}
author{A}
title{B}
begin{document}
maketitle
tableofcontents
part{title}
section{title}
section{title}
section{title}
part{title}
section{title}
section{title}
section{title}
part{title}
section{title}
section{title}
section{title}
end{document}


Whats wrong? Any idea how to fix this problem?










share|improve this question




















  • 3




    I think this happened because you missed chapter{...}. book document class expects the following hierarchy: part → chapter → section → subsection → ...
    – andselisk
    2 days ago










  • I know this priority. but I don't want to use chapters.
    – C.F.G
    2 days ago






  • 2




    You could change to article which does have parts and sections but no chapters…
    – TeXnician
    2 days ago






  • 2




    @C.F.G: You could use the bookmark package, that 'sanitizes' the bookmarks and keeps the levels in order, but actually, omitting chapters is an logical error!
    – Christian Hupfer
    2 days ago








  • 1




    Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.
    – Christian Hupfer
    2 days ago
















3














I am writing a book that has 3 parts and each part has many sections. After compiling the .tex file, some of the bookmarks of the .pdf file are misplaced as shown in below:



enter image description here



and its MWE



documentclass[12pt,a4paper]{book}
usepackage{hyperref}
author{A}
title{B}
begin{document}
maketitle
tableofcontents
part{title}
section{title}
section{title}
section{title}
part{title}
section{title}
section{title}
section{title}
part{title}
section{title}
section{title}
section{title}
end{document}


Whats wrong? Any idea how to fix this problem?










share|improve this question




















  • 3




    I think this happened because you missed chapter{...}. book document class expects the following hierarchy: part → chapter → section → subsection → ...
    – andselisk
    2 days ago










  • I know this priority. but I don't want to use chapters.
    – C.F.G
    2 days ago






  • 2




    You could change to article which does have parts and sections but no chapters…
    – TeXnician
    2 days ago






  • 2




    @C.F.G: You could use the bookmark package, that 'sanitizes' the bookmarks and keeps the levels in order, but actually, omitting chapters is an logical error!
    – Christian Hupfer
    2 days ago








  • 1




    Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.
    – Christian Hupfer
    2 days ago














3












3








3







I am writing a book that has 3 parts and each part has many sections. After compiling the .tex file, some of the bookmarks of the .pdf file are misplaced as shown in below:



enter image description here



and its MWE



documentclass[12pt,a4paper]{book}
usepackage{hyperref}
author{A}
title{B}
begin{document}
maketitle
tableofcontents
part{title}
section{title}
section{title}
section{title}
part{title}
section{title}
section{title}
section{title}
part{title}
section{title}
section{title}
section{title}
end{document}


Whats wrong? Any idea how to fix this problem?










share|improve this question















I am writing a book that has 3 parts and each part has many sections. After compiling the .tex file, some of the bookmarks of the .pdf file are misplaced as shown in below:



enter image description here



and its MWE



documentclass[12pt,a4paper]{book}
usepackage{hyperref}
author{A}
title{B}
begin{document}
maketitle
tableofcontents
part{title}
section{title}
section{title}
section{title}
part{title}
section{title}
section{title}
section{title}
part{title}
section{title}
section{title}
section{title}
end{document}


Whats wrong? Any idea how to fix this problem?







sectioning hyperref bookmarks






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Christian Hupfer

148k14193388




148k14193388










asked 2 days ago









C.F.G

462312




462312








  • 3




    I think this happened because you missed chapter{...}. book document class expects the following hierarchy: part → chapter → section → subsection → ...
    – andselisk
    2 days ago










  • I know this priority. but I don't want to use chapters.
    – C.F.G
    2 days ago






  • 2




    You could change to article which does have parts and sections but no chapters…
    – TeXnician
    2 days ago






  • 2




    @C.F.G: You could use the bookmark package, that 'sanitizes' the bookmarks and keeps the levels in order, but actually, omitting chapters is an logical error!
    – Christian Hupfer
    2 days ago








  • 1




    Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.
    – Christian Hupfer
    2 days ago














  • 3




    I think this happened because you missed chapter{...}. book document class expects the following hierarchy: part → chapter → section → subsection → ...
    – andselisk
    2 days ago










  • I know this priority. but I don't want to use chapters.
    – C.F.G
    2 days ago






  • 2




    You could change to article which does have parts and sections but no chapters…
    – TeXnician
    2 days ago






  • 2




    @C.F.G: You could use the bookmark package, that 'sanitizes' the bookmarks and keeps the levels in order, but actually, omitting chapters is an logical error!
    – Christian Hupfer
    2 days ago








  • 1




    Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.
    – Christian Hupfer
    2 days ago








3




3




I think this happened because you missed chapter{...}. book document class expects the following hierarchy: part → chapter → section → subsection → ...
– andselisk
2 days ago




I think this happened because you missed chapter{...}. book document class expects the following hierarchy: part → chapter → section → subsection → ...
– andselisk
2 days ago












I know this priority. but I don't want to use chapters.
– C.F.G
2 days ago




I know this priority. but I don't want to use chapters.
– C.F.G
2 days ago




2




2




You could change to article which does have parts and sections but no chapters…
– TeXnician
2 days ago




You could change to article which does have parts and sections but no chapters…
– TeXnician
2 days ago




2




2




@C.F.G: You could use the bookmark package, that 'sanitizes' the bookmarks and keeps the levels in order, but actually, omitting chapters is an logical error!
– Christian Hupfer
2 days ago






@C.F.G: You could use the bookmark package, that 'sanitizes' the bookmarks and keeps the levels in order, but actually, omitting chapters is an logical error!
– Christian Hupfer
2 days ago






1




1




Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.
– Christian Hupfer
2 days ago




Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.
– Christian Hupfer
2 days ago










1 Answer
1






active

oldest

votes


















4














The hierarchy of levels (that's why it is called level) in book class, is with their associated numbers, starting from top to bottom




part (-1) - chapter (0) - section (1) - subsection (2) - subsubsection
(3) - paragraph (4) - subparagraph (5)




Omitting one level is a logical error that confuses hyperref. Either do not omit chapter or use the bookmark package that cleans up the wrong leveling.



A third method involves reassigning the level numbers for the bookmarks, i.e. there is a toclevel@X which X standing for one of the above mentioned levels.



Please note, that this does not cure the problem that the sections appear with a 0 as prefix in the section number and section numbers are never reset this way (since the chapter counter is not stepped).



Summary: The proper way is to switch to article or including chapter as sectioning level.



documentclass[12pt,a4paper]{book}
usepackage{hyperref}

makeatletter
renewcommand{toclevel@section}{0}
renewcommand{toclevel@subsection}{1}
renewcommand{toclevel@subsubsection}{2}
renewcommand{toclevel@paragraph}{3}
renewcommand{toclevel@subparagraph}{4}
makeatother
%usepackage{bookmark}
author{A}
title{B}
begin{document}
maketitle
tableofcontents
part{title}
section{title}
section{title}
section{title}
part{title}
section{title}
section{title}
section{title}
part{title}
section{title}
section{title}
section{title}
end{document}


enter image description here






share|improve this answer























    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%2f467991%2fproblem-on-position-of-bookmarks-in-pdf%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









    4














    The hierarchy of levels (that's why it is called level) in book class, is with their associated numbers, starting from top to bottom




    part (-1) - chapter (0) - section (1) - subsection (2) - subsubsection
    (3) - paragraph (4) - subparagraph (5)




    Omitting one level is a logical error that confuses hyperref. Either do not omit chapter or use the bookmark package that cleans up the wrong leveling.



    A third method involves reassigning the level numbers for the bookmarks, i.e. there is a toclevel@X which X standing for one of the above mentioned levels.



    Please note, that this does not cure the problem that the sections appear with a 0 as prefix in the section number and section numbers are never reset this way (since the chapter counter is not stepped).



    Summary: The proper way is to switch to article or including chapter as sectioning level.



    documentclass[12pt,a4paper]{book}
    usepackage{hyperref}

    makeatletter
    renewcommand{toclevel@section}{0}
    renewcommand{toclevel@subsection}{1}
    renewcommand{toclevel@subsubsection}{2}
    renewcommand{toclevel@paragraph}{3}
    renewcommand{toclevel@subparagraph}{4}
    makeatother
    %usepackage{bookmark}
    author{A}
    title{B}
    begin{document}
    maketitle
    tableofcontents
    part{title}
    section{title}
    section{title}
    section{title}
    part{title}
    section{title}
    section{title}
    section{title}
    part{title}
    section{title}
    section{title}
    section{title}
    end{document}


    enter image description here






    share|improve this answer




























      4














      The hierarchy of levels (that's why it is called level) in book class, is with their associated numbers, starting from top to bottom




      part (-1) - chapter (0) - section (1) - subsection (2) - subsubsection
      (3) - paragraph (4) - subparagraph (5)




      Omitting one level is a logical error that confuses hyperref. Either do not omit chapter or use the bookmark package that cleans up the wrong leveling.



      A third method involves reassigning the level numbers for the bookmarks, i.e. there is a toclevel@X which X standing for one of the above mentioned levels.



      Please note, that this does not cure the problem that the sections appear with a 0 as prefix in the section number and section numbers are never reset this way (since the chapter counter is not stepped).



      Summary: The proper way is to switch to article or including chapter as sectioning level.



      documentclass[12pt,a4paper]{book}
      usepackage{hyperref}

      makeatletter
      renewcommand{toclevel@section}{0}
      renewcommand{toclevel@subsection}{1}
      renewcommand{toclevel@subsubsection}{2}
      renewcommand{toclevel@paragraph}{3}
      renewcommand{toclevel@subparagraph}{4}
      makeatother
      %usepackage{bookmark}
      author{A}
      title{B}
      begin{document}
      maketitle
      tableofcontents
      part{title}
      section{title}
      section{title}
      section{title}
      part{title}
      section{title}
      section{title}
      section{title}
      part{title}
      section{title}
      section{title}
      section{title}
      end{document}


      enter image description here






      share|improve this answer


























        4












        4








        4






        The hierarchy of levels (that's why it is called level) in book class, is with their associated numbers, starting from top to bottom




        part (-1) - chapter (0) - section (1) - subsection (2) - subsubsection
        (3) - paragraph (4) - subparagraph (5)




        Omitting one level is a logical error that confuses hyperref. Either do not omit chapter or use the bookmark package that cleans up the wrong leveling.



        A third method involves reassigning the level numbers for the bookmarks, i.e. there is a toclevel@X which X standing for one of the above mentioned levels.



        Please note, that this does not cure the problem that the sections appear with a 0 as prefix in the section number and section numbers are never reset this way (since the chapter counter is not stepped).



        Summary: The proper way is to switch to article or including chapter as sectioning level.



        documentclass[12pt,a4paper]{book}
        usepackage{hyperref}

        makeatletter
        renewcommand{toclevel@section}{0}
        renewcommand{toclevel@subsection}{1}
        renewcommand{toclevel@subsubsection}{2}
        renewcommand{toclevel@paragraph}{3}
        renewcommand{toclevel@subparagraph}{4}
        makeatother
        %usepackage{bookmark}
        author{A}
        title{B}
        begin{document}
        maketitle
        tableofcontents
        part{title}
        section{title}
        section{title}
        section{title}
        part{title}
        section{title}
        section{title}
        section{title}
        part{title}
        section{title}
        section{title}
        section{title}
        end{document}


        enter image description here






        share|improve this answer














        The hierarchy of levels (that's why it is called level) in book class, is with their associated numbers, starting from top to bottom




        part (-1) - chapter (0) - section (1) - subsection (2) - subsubsection
        (3) - paragraph (4) - subparagraph (5)




        Omitting one level is a logical error that confuses hyperref. Either do not omit chapter or use the bookmark package that cleans up the wrong leveling.



        A third method involves reassigning the level numbers for the bookmarks, i.e. there is a toclevel@X which X standing for one of the above mentioned levels.



        Please note, that this does not cure the problem that the sections appear with a 0 as prefix in the section number and section numbers are never reset this way (since the chapter counter is not stepped).



        Summary: The proper way is to switch to article or including chapter as sectioning level.



        documentclass[12pt,a4paper]{book}
        usepackage{hyperref}

        makeatletter
        renewcommand{toclevel@section}{0}
        renewcommand{toclevel@subsection}{1}
        renewcommand{toclevel@subsubsection}{2}
        renewcommand{toclevel@paragraph}{3}
        renewcommand{toclevel@subparagraph}{4}
        makeatother
        %usepackage{bookmark}
        author{A}
        title{B}
        begin{document}
        maketitle
        tableofcontents
        part{title}
        section{title}
        section{title}
        section{title}
        part{title}
        section{title}
        section{title}
        section{title}
        part{title}
        section{title}
        section{title}
        section{title}
        end{document}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 days ago

























        answered 2 days ago









        Christian Hupfer

        148k14193388




        148k14193388






























            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%2f467991%2fproblem-on-position-of-bookmarks-in-pdf%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

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            RAC Tourist Trophy