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
    Dec 31 '18 at 6:10











  • I know this priority. but I don't want to use chapters.

    – C.F.G
    Dec 31 '18 at 6:21






  • 2





    You could change to article which does have parts and sections but no chapters…

    – TeXnician
    Dec 31 '18 at 8:20






  • 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
    Dec 31 '18 at 8:22








  • 1





    Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.

    – Christian Hupfer
    Dec 31 '18 at 8:31
















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
    Dec 31 '18 at 6:10











  • I know this priority. but I don't want to use chapters.

    – C.F.G
    Dec 31 '18 at 6:21






  • 2





    You could change to article which does have parts and sections but no chapters…

    – TeXnician
    Dec 31 '18 at 8:20






  • 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
    Dec 31 '18 at 8:22








  • 1





    Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.

    – Christian Hupfer
    Dec 31 '18 at 8:31














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 Dec 31 '18 at 8:59









Christian Hupfer

151k15199395




151k15199395










asked Dec 31 '18 at 6:02









C.F.GC.F.G

582312




582312








  • 3





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

    – andselisk
    Dec 31 '18 at 6:10











  • I know this priority. but I don't want to use chapters.

    – C.F.G
    Dec 31 '18 at 6:21






  • 2





    You could change to article which does have parts and sections but no chapters…

    – TeXnician
    Dec 31 '18 at 8:20






  • 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
    Dec 31 '18 at 8:22








  • 1





    Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.

    – Christian Hupfer
    Dec 31 '18 at 8:31














  • 3





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

    – andselisk
    Dec 31 '18 at 6:10











  • I know this priority. but I don't want to use chapters.

    – C.F.G
    Dec 31 '18 at 6:21






  • 2





    You could change to article which does have parts and sections but no chapters…

    – TeXnician
    Dec 31 '18 at 8:20






  • 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
    Dec 31 '18 at 8:22








  • 1





    Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.

    – Christian Hupfer
    Dec 31 '18 at 8:31








3




3





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

– andselisk
Dec 31 '18 at 6:10





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

– andselisk
Dec 31 '18 at 6:10













I know this priority. but I don't want to use chapters.

– C.F.G
Dec 31 '18 at 6:21





I know this priority. but I don't want to use chapters.

– C.F.G
Dec 31 '18 at 6:21




2




2





You could change to article which does have parts and sections but no chapters…

– TeXnician
Dec 31 '18 at 8:20





You could change to article which does have parts and sections but no chapters…

– TeXnician
Dec 31 '18 at 8:20




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
Dec 31 '18 at 8:22







@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
Dec 31 '18 at 8:22






1




1





Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.

– Christian Hupfer
Dec 31 '18 at 8:31





Omitting the chapter will also lead to section numbers like 0.5 showing up, which is awful.

– Christian Hupfer
Dec 31 '18 at 8:31










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 Dec 31 '18 at 8:58

























        answered Dec 31 '18 at 8:26









        Christian HupferChristian Hupfer

        151k15199395




        151k15199395






























            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.




            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

            Bressuire

            Cabo Verde

            Gyllenstierna