Conflict between appendix, bookmark, hyperref and magyar babel due to utf8 chars











up vote
5
down vote

favorite












I tried to use babel with the magyar language along with the package appendix and hyperref. There is an issue with the warnings of magyar babel and a I also had a similar problem to that one when one loads the dutch language for babel. My approach was to mix the the solutions in mweA.tex:



UseRawInputEncoding % [2]
documentclass{book}
usepackage{hyperref} % either I have it or not
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}

defmagyarOptions{defaults=hu-min} % [2]
usepackage[magyar]{babel}

usepackage[titletoc]{appendix}
usepackage{bookmark} % [1]

begin{document}

tableofcontents

begin{appendices}
chapter{test appendix}
end{appendices}
end{document}


or in mweB.tex:



documentclass{book}    
usepackage{hyperref} % either I have it or not
usepackage[T1]{fontenc}

defmagyarOptions{defaults=hu-min,suggestions=no} % [2]
usepackage[magyar]{babel}

usepackage[titletoc]{appendix}
usepackage{bookmark} % [1]

begin{document}

tableofcontents

begin{appendices}
chapter{test appendix}
end{appendices}
end{document}


(References in the code: [1] [2].) But in both cases I got the following error:



! Undefined control sequence.
GenericError ...
#4 errhelp @err@ ...
l.1 ...mberline {A}test appendix}{3}{függelék.a.A}


What is going wrong here? How could I use the package appendix with magyar babel?



I figured out that without usepackage{hyperref} I got the same errors, but if I remove usepackage{bookmark}, the problems disappear. But I'd like to use the usepackage{hyperref} package.










share|improve this question







New contributor




DanielTuzes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    5
    down vote

    favorite












    I tried to use babel with the magyar language along with the package appendix and hyperref. There is an issue with the warnings of magyar babel and a I also had a similar problem to that one when one loads the dutch language for babel. My approach was to mix the the solutions in mweA.tex:



    UseRawInputEncoding % [2]
    documentclass{book}
    usepackage{hyperref} % either I have it or not
    usepackage[T1]{fontenc}
    usepackage[utf8]{inputenc}

    defmagyarOptions{defaults=hu-min} % [2]
    usepackage[magyar]{babel}

    usepackage[titletoc]{appendix}
    usepackage{bookmark} % [1]

    begin{document}

    tableofcontents

    begin{appendices}
    chapter{test appendix}
    end{appendices}
    end{document}


    or in mweB.tex:



    documentclass{book}    
    usepackage{hyperref} % either I have it or not
    usepackage[T1]{fontenc}

    defmagyarOptions{defaults=hu-min,suggestions=no} % [2]
    usepackage[magyar]{babel}

    usepackage[titletoc]{appendix}
    usepackage{bookmark} % [1]

    begin{document}

    tableofcontents

    begin{appendices}
    chapter{test appendix}
    end{appendices}
    end{document}


    (References in the code: [1] [2].) But in both cases I got the following error:



    ! Undefined control sequence.
    GenericError ...
    #4 errhelp @err@ ...
    l.1 ...mberline {A}test appendix}{3}{függelék.a.A}


    What is going wrong here? How could I use the package appendix with magyar babel?



    I figured out that without usepackage{hyperref} I got the same errors, but if I remove usepackage{bookmark}, the problems disappear. But I'd like to use the usepackage{hyperref} package.










    share|improve this question







    New contributor




    DanielTuzes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      5
      down vote

      favorite









      up vote
      5
      down vote

      favorite











      I tried to use babel with the magyar language along with the package appendix and hyperref. There is an issue with the warnings of magyar babel and a I also had a similar problem to that one when one loads the dutch language for babel. My approach was to mix the the solutions in mweA.tex:



      UseRawInputEncoding % [2]
      documentclass{book}
      usepackage{hyperref} % either I have it or not
      usepackage[T1]{fontenc}
      usepackage[utf8]{inputenc}

      defmagyarOptions{defaults=hu-min} % [2]
      usepackage[magyar]{babel}

      usepackage[titletoc]{appendix}
      usepackage{bookmark} % [1]

      begin{document}

      tableofcontents

      begin{appendices}
      chapter{test appendix}
      end{appendices}
      end{document}


      or in mweB.tex:



      documentclass{book}    
      usepackage{hyperref} % either I have it or not
      usepackage[T1]{fontenc}

      defmagyarOptions{defaults=hu-min,suggestions=no} % [2]
      usepackage[magyar]{babel}

      usepackage[titletoc]{appendix}
      usepackage{bookmark} % [1]

      begin{document}

      tableofcontents

      begin{appendices}
      chapter{test appendix}
      end{appendices}
      end{document}


      (References in the code: [1] [2].) But in both cases I got the following error:



      ! Undefined control sequence.
      GenericError ...
      #4 errhelp @err@ ...
      l.1 ...mberline {A}test appendix}{3}{függelék.a.A}


      What is going wrong here? How could I use the package appendix with magyar babel?



      I figured out that without usepackage{hyperref} I got the same errors, but if I remove usepackage{bookmark}, the problems disappear. But I'd like to use the usepackage{hyperref} package.










      share|improve this question







      New contributor




      DanielTuzes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I tried to use babel with the magyar language along with the package appendix and hyperref. There is an issue with the warnings of magyar babel and a I also had a similar problem to that one when one loads the dutch language for babel. My approach was to mix the the solutions in mweA.tex:



      UseRawInputEncoding % [2]
      documentclass{book}
      usepackage{hyperref} % either I have it or not
      usepackage[T1]{fontenc}
      usepackage[utf8]{inputenc}

      defmagyarOptions{defaults=hu-min} % [2]
      usepackage[magyar]{babel}

      usepackage[titletoc]{appendix}
      usepackage{bookmark} % [1]

      begin{document}

      tableofcontents

      begin{appendices}
      chapter{test appendix}
      end{appendices}
      end{document}


      or in mweB.tex:



      documentclass{book}    
      usepackage{hyperref} % either I have it or not
      usepackage[T1]{fontenc}

      defmagyarOptions{defaults=hu-min,suggestions=no} % [2]
      usepackage[magyar]{babel}

      usepackage[titletoc]{appendix}
      usepackage{bookmark} % [1]

      begin{document}

      tableofcontents

      begin{appendices}
      chapter{test appendix}
      end{appendices}
      end{document}


      (References in the code: [1] [2].) But in both cases I got the following error:



      ! Undefined control sequence.
      GenericError ...
      #4 errhelp @err@ ...
      l.1 ...mberline {A}test appendix}{3}{függelék.a.A}


      What is going wrong here? How could I use the package appendix with magyar babel?



      I figured out that without usepackage{hyperref} I got the same errors, but if I remove usepackage{bookmark}, the problems disappear. But I'd like to use the usepackage{hyperref} package.







      hyperref babel unicode appendices bookmarks






      share|improve this question







      New contributor




      DanielTuzes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      DanielTuzes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      DanielTuzes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 21 at 13:46









      DanielTuzes

      1426




      1426




      New contributor




      DanielTuzes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      DanielTuzes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      DanielTuzes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          The problematic bit seems to be



          contentsline {chapter}{f"uggel'ek numberline {A}test appendix}{3}{függelék.1.A}


          that is produced in the .aux and .toc file when the example is run.



          In particular the fact that the last argument of contentsline, the link destination label, contains non-ASCII characters really seems to bother pdfTeX, where non-ASCII characters in label should be avoided (see Non-ASCII character in label and Non-English identifiers in label / ref ("Missing endcsname inserted")). (The MWEs both work fine with LuaLaTeX. Interestingly XeLaTeX seems to hang on something as well, which I did not expect ...)



          You can instruct appendix not to use the translated string függelék as a label, but to stick with the safe appendix as defined in Hy@appendixstring instead.



          With



          UseRawInputEncoding
          documentclass{book}
          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}
          defmagyarOptions{defaults=hu-min}
          usepackage[magyar]{babel}
          usepackage[titletoc]{appendix}
          usepackage{hyperref}
          usepackage{bookmark}

          makeatletter
          renewcommand{@resets@pp}{par
          @ppsavesec
          stepcounter{@pps}
          setcounter{section}{0}%
          if@chapter@pp
          setcounter{chapter}{0}%
          renewcommand@chapapp{appendixname}%
          renewcommandthechapter{@Alphc@chapter}%
          else
          setcounter{subsection}{0}%
          renewcommandthesection{@Alphc@section}%
          fi
          if@pphyper
          if@chapter@pp
          renewcommand{theHchapter}{theH@pps.Alph{chapter}}%
          else
          renewcommand{theHsection}{theH@pps.Alph{section}}%
          fi
          xdefHy@chapapp{Hy@appendixstring}% <- changed appendixname to Hy@appendixstring
          fi
          restoreapp
          }
          renewcommand{@resets@ppsub}{par
          stepcounter{@pps}
          if@chapter@pp
          setcounter{section}{0}
          renewcommand{thesection}{setthesection}
          else
          setcounter{subsection}{0}
          renewcommand{thesubsection}{setthesubsection}
          fi
          if@pphyper
          if@chapter@pp
          renewcommand{theHsection}{theH@pps.setthesection}%
          else
          renewcommand{theHsubsection}{theH@pps.setthesubsection}%
          fi
          xdefHy@chapapp{Hy@appendixstring}% <- changed appendixname to Hy@appendixstring
          fi
          }
          makeatother

          begin{document}

          tableofcontents

          begin{appendices}
          chapter{test appendix}
          end{appendices}
          end{document}


          the example should compile. The xdefHy@chapapp{Hy@appendixstring} instead of appendix.sty's defHy@chapapp{appendixname} is directly taken from hyperref.sty's definition of appendix. This is exactly what was the cause of the issue in Conflict between babel, hyperref and appendix package as well, but the workaround mentioned there did not help here - we really had to address the root of the issue directly. See also Apéndices (Appendix spanish accent), How to make appendix and hyperref packages work together with cyrillic (non ASCII) characters?, Hyperref, Bookmark and Appendix packages: Getting labels inside Appendices to work.



          You should probably delete your temporary files and recompile from scratch to avoid remnants of the old code in the auxiliary files messing things up.



          You may also want to consider writing to the maintainer of appendix.sty about this issue. At least to me it seems like a good idea to use the safe string Hy@appendixstring here instead of the potentially dangerous appendixname.



          Note that I changed the loading order in your preamble a bit. hyperref should usually be the last package you load (there are a few documented exceptions like cleveref and some matters of taste, like the order together with bookmark: Which package should I load first: hyperref or bookmark?): It was loaded very (too?) early in your example.






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


            }
            });






            DanielTuzes is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461125%2fconflict-between-appendix-bookmark-hyperref-and-magyar-babel-due-to-utf8-chars%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








            up vote
            4
            down vote



            accepted










            The problematic bit seems to be



            contentsline {chapter}{f"uggel'ek numberline {A}test appendix}{3}{függelék.1.A}


            that is produced in the .aux and .toc file when the example is run.



            In particular the fact that the last argument of contentsline, the link destination label, contains non-ASCII characters really seems to bother pdfTeX, where non-ASCII characters in label should be avoided (see Non-ASCII character in label and Non-English identifiers in label / ref ("Missing endcsname inserted")). (The MWEs both work fine with LuaLaTeX. Interestingly XeLaTeX seems to hang on something as well, which I did not expect ...)



            You can instruct appendix not to use the translated string függelék as a label, but to stick with the safe appendix as defined in Hy@appendixstring instead.



            With



            UseRawInputEncoding
            documentclass{book}
            usepackage[T1]{fontenc}
            usepackage[utf8]{inputenc}
            defmagyarOptions{defaults=hu-min}
            usepackage[magyar]{babel}
            usepackage[titletoc]{appendix}
            usepackage{hyperref}
            usepackage{bookmark}

            makeatletter
            renewcommand{@resets@pp}{par
            @ppsavesec
            stepcounter{@pps}
            setcounter{section}{0}%
            if@chapter@pp
            setcounter{chapter}{0}%
            renewcommand@chapapp{appendixname}%
            renewcommandthechapter{@Alphc@chapter}%
            else
            setcounter{subsection}{0}%
            renewcommandthesection{@Alphc@section}%
            fi
            if@pphyper
            if@chapter@pp
            renewcommand{theHchapter}{theH@pps.Alph{chapter}}%
            else
            renewcommand{theHsection}{theH@pps.Alph{section}}%
            fi
            xdefHy@chapapp{Hy@appendixstring}% <- changed appendixname to Hy@appendixstring
            fi
            restoreapp
            }
            renewcommand{@resets@ppsub}{par
            stepcounter{@pps}
            if@chapter@pp
            setcounter{section}{0}
            renewcommand{thesection}{setthesection}
            else
            setcounter{subsection}{0}
            renewcommand{thesubsection}{setthesubsection}
            fi
            if@pphyper
            if@chapter@pp
            renewcommand{theHsection}{theH@pps.setthesection}%
            else
            renewcommand{theHsubsection}{theH@pps.setthesubsection}%
            fi
            xdefHy@chapapp{Hy@appendixstring}% <- changed appendixname to Hy@appendixstring
            fi
            }
            makeatother

            begin{document}

            tableofcontents

            begin{appendices}
            chapter{test appendix}
            end{appendices}
            end{document}


            the example should compile. The xdefHy@chapapp{Hy@appendixstring} instead of appendix.sty's defHy@chapapp{appendixname} is directly taken from hyperref.sty's definition of appendix. This is exactly what was the cause of the issue in Conflict between babel, hyperref and appendix package as well, but the workaround mentioned there did not help here - we really had to address the root of the issue directly. See also Apéndices (Appendix spanish accent), How to make appendix and hyperref packages work together with cyrillic (non ASCII) characters?, Hyperref, Bookmark and Appendix packages: Getting labels inside Appendices to work.



            You should probably delete your temporary files and recompile from scratch to avoid remnants of the old code in the auxiliary files messing things up.



            You may also want to consider writing to the maintainer of appendix.sty about this issue. At least to me it seems like a good idea to use the safe string Hy@appendixstring here instead of the potentially dangerous appendixname.



            Note that I changed the loading order in your preamble a bit. hyperref should usually be the last package you load (there are a few documented exceptions like cleveref and some matters of taste, like the order together with bookmark: Which package should I load first: hyperref or bookmark?): It was loaded very (too?) early in your example.






            share|improve this answer



























              up vote
              4
              down vote



              accepted










              The problematic bit seems to be



              contentsline {chapter}{f"uggel'ek numberline {A}test appendix}{3}{függelék.1.A}


              that is produced in the .aux and .toc file when the example is run.



              In particular the fact that the last argument of contentsline, the link destination label, contains non-ASCII characters really seems to bother pdfTeX, where non-ASCII characters in label should be avoided (see Non-ASCII character in label and Non-English identifiers in label / ref ("Missing endcsname inserted")). (The MWEs both work fine with LuaLaTeX. Interestingly XeLaTeX seems to hang on something as well, which I did not expect ...)



              You can instruct appendix not to use the translated string függelék as a label, but to stick with the safe appendix as defined in Hy@appendixstring instead.



              With



              UseRawInputEncoding
              documentclass{book}
              usepackage[T1]{fontenc}
              usepackage[utf8]{inputenc}
              defmagyarOptions{defaults=hu-min}
              usepackage[magyar]{babel}
              usepackage[titletoc]{appendix}
              usepackage{hyperref}
              usepackage{bookmark}

              makeatletter
              renewcommand{@resets@pp}{par
              @ppsavesec
              stepcounter{@pps}
              setcounter{section}{0}%
              if@chapter@pp
              setcounter{chapter}{0}%
              renewcommand@chapapp{appendixname}%
              renewcommandthechapter{@Alphc@chapter}%
              else
              setcounter{subsection}{0}%
              renewcommandthesection{@Alphc@section}%
              fi
              if@pphyper
              if@chapter@pp
              renewcommand{theHchapter}{theH@pps.Alph{chapter}}%
              else
              renewcommand{theHsection}{theH@pps.Alph{section}}%
              fi
              xdefHy@chapapp{Hy@appendixstring}% <- changed appendixname to Hy@appendixstring
              fi
              restoreapp
              }
              renewcommand{@resets@ppsub}{par
              stepcounter{@pps}
              if@chapter@pp
              setcounter{section}{0}
              renewcommand{thesection}{setthesection}
              else
              setcounter{subsection}{0}
              renewcommand{thesubsection}{setthesubsection}
              fi
              if@pphyper
              if@chapter@pp
              renewcommand{theHsection}{theH@pps.setthesection}%
              else
              renewcommand{theHsubsection}{theH@pps.setthesubsection}%
              fi
              xdefHy@chapapp{Hy@appendixstring}% <- changed appendixname to Hy@appendixstring
              fi
              }
              makeatother

              begin{document}

              tableofcontents

              begin{appendices}
              chapter{test appendix}
              end{appendices}
              end{document}


              the example should compile. The xdefHy@chapapp{Hy@appendixstring} instead of appendix.sty's defHy@chapapp{appendixname} is directly taken from hyperref.sty's definition of appendix. This is exactly what was the cause of the issue in Conflict between babel, hyperref and appendix package as well, but the workaround mentioned there did not help here - we really had to address the root of the issue directly. See also Apéndices (Appendix spanish accent), How to make appendix and hyperref packages work together with cyrillic (non ASCII) characters?, Hyperref, Bookmark and Appendix packages: Getting labels inside Appendices to work.



              You should probably delete your temporary files and recompile from scratch to avoid remnants of the old code in the auxiliary files messing things up.



              You may also want to consider writing to the maintainer of appendix.sty about this issue. At least to me it seems like a good idea to use the safe string Hy@appendixstring here instead of the potentially dangerous appendixname.



              Note that I changed the loading order in your preamble a bit. hyperref should usually be the last package you load (there are a few documented exceptions like cleveref and some matters of taste, like the order together with bookmark: Which package should I load first: hyperref or bookmark?): It was loaded very (too?) early in your example.






              share|improve this answer

























                up vote
                4
                down vote



                accepted







                up vote
                4
                down vote



                accepted






                The problematic bit seems to be



                contentsline {chapter}{f"uggel'ek numberline {A}test appendix}{3}{függelék.1.A}


                that is produced in the .aux and .toc file when the example is run.



                In particular the fact that the last argument of contentsline, the link destination label, contains non-ASCII characters really seems to bother pdfTeX, where non-ASCII characters in label should be avoided (see Non-ASCII character in label and Non-English identifiers in label / ref ("Missing endcsname inserted")). (The MWEs both work fine with LuaLaTeX. Interestingly XeLaTeX seems to hang on something as well, which I did not expect ...)



                You can instruct appendix not to use the translated string függelék as a label, but to stick with the safe appendix as defined in Hy@appendixstring instead.



                With



                UseRawInputEncoding
                documentclass{book}
                usepackage[T1]{fontenc}
                usepackage[utf8]{inputenc}
                defmagyarOptions{defaults=hu-min}
                usepackage[magyar]{babel}
                usepackage[titletoc]{appendix}
                usepackage{hyperref}
                usepackage{bookmark}

                makeatletter
                renewcommand{@resets@pp}{par
                @ppsavesec
                stepcounter{@pps}
                setcounter{section}{0}%
                if@chapter@pp
                setcounter{chapter}{0}%
                renewcommand@chapapp{appendixname}%
                renewcommandthechapter{@Alphc@chapter}%
                else
                setcounter{subsection}{0}%
                renewcommandthesection{@Alphc@section}%
                fi
                if@pphyper
                if@chapter@pp
                renewcommand{theHchapter}{theH@pps.Alph{chapter}}%
                else
                renewcommand{theHsection}{theH@pps.Alph{section}}%
                fi
                xdefHy@chapapp{Hy@appendixstring}% <- changed appendixname to Hy@appendixstring
                fi
                restoreapp
                }
                renewcommand{@resets@ppsub}{par
                stepcounter{@pps}
                if@chapter@pp
                setcounter{section}{0}
                renewcommand{thesection}{setthesection}
                else
                setcounter{subsection}{0}
                renewcommand{thesubsection}{setthesubsection}
                fi
                if@pphyper
                if@chapter@pp
                renewcommand{theHsection}{theH@pps.setthesection}%
                else
                renewcommand{theHsubsection}{theH@pps.setthesubsection}%
                fi
                xdefHy@chapapp{Hy@appendixstring}% <- changed appendixname to Hy@appendixstring
                fi
                }
                makeatother

                begin{document}

                tableofcontents

                begin{appendices}
                chapter{test appendix}
                end{appendices}
                end{document}


                the example should compile. The xdefHy@chapapp{Hy@appendixstring} instead of appendix.sty's defHy@chapapp{appendixname} is directly taken from hyperref.sty's definition of appendix. This is exactly what was the cause of the issue in Conflict between babel, hyperref and appendix package as well, but the workaround mentioned there did not help here - we really had to address the root of the issue directly. See also Apéndices (Appendix spanish accent), How to make appendix and hyperref packages work together with cyrillic (non ASCII) characters?, Hyperref, Bookmark and Appendix packages: Getting labels inside Appendices to work.



                You should probably delete your temporary files and recompile from scratch to avoid remnants of the old code in the auxiliary files messing things up.



                You may also want to consider writing to the maintainer of appendix.sty about this issue. At least to me it seems like a good idea to use the safe string Hy@appendixstring here instead of the potentially dangerous appendixname.



                Note that I changed the loading order in your preamble a bit. hyperref should usually be the last package you load (there are a few documented exceptions like cleveref and some matters of taste, like the order together with bookmark: Which package should I load first: hyperref or bookmark?): It was loaded very (too?) early in your example.






                share|improve this answer














                The problematic bit seems to be



                contentsline {chapter}{f"uggel'ek numberline {A}test appendix}{3}{függelék.1.A}


                that is produced in the .aux and .toc file when the example is run.



                In particular the fact that the last argument of contentsline, the link destination label, contains non-ASCII characters really seems to bother pdfTeX, where non-ASCII characters in label should be avoided (see Non-ASCII character in label and Non-English identifiers in label / ref ("Missing endcsname inserted")). (The MWEs both work fine with LuaLaTeX. Interestingly XeLaTeX seems to hang on something as well, which I did not expect ...)



                You can instruct appendix not to use the translated string függelék as a label, but to stick with the safe appendix as defined in Hy@appendixstring instead.



                With



                UseRawInputEncoding
                documentclass{book}
                usepackage[T1]{fontenc}
                usepackage[utf8]{inputenc}
                defmagyarOptions{defaults=hu-min}
                usepackage[magyar]{babel}
                usepackage[titletoc]{appendix}
                usepackage{hyperref}
                usepackage{bookmark}

                makeatletter
                renewcommand{@resets@pp}{par
                @ppsavesec
                stepcounter{@pps}
                setcounter{section}{0}%
                if@chapter@pp
                setcounter{chapter}{0}%
                renewcommand@chapapp{appendixname}%
                renewcommandthechapter{@Alphc@chapter}%
                else
                setcounter{subsection}{0}%
                renewcommandthesection{@Alphc@section}%
                fi
                if@pphyper
                if@chapter@pp
                renewcommand{theHchapter}{theH@pps.Alph{chapter}}%
                else
                renewcommand{theHsection}{theH@pps.Alph{section}}%
                fi
                xdefHy@chapapp{Hy@appendixstring}% <- changed appendixname to Hy@appendixstring
                fi
                restoreapp
                }
                renewcommand{@resets@ppsub}{par
                stepcounter{@pps}
                if@chapter@pp
                setcounter{section}{0}
                renewcommand{thesection}{setthesection}
                else
                setcounter{subsection}{0}
                renewcommand{thesubsection}{setthesubsection}
                fi
                if@pphyper
                if@chapter@pp
                renewcommand{theHsection}{theH@pps.setthesection}%
                else
                renewcommand{theHsubsection}{theH@pps.setthesubsection}%
                fi
                xdefHy@chapapp{Hy@appendixstring}% <- changed appendixname to Hy@appendixstring
                fi
                }
                makeatother

                begin{document}

                tableofcontents

                begin{appendices}
                chapter{test appendix}
                end{appendices}
                end{document}


                the example should compile. The xdefHy@chapapp{Hy@appendixstring} instead of appendix.sty's defHy@chapapp{appendixname} is directly taken from hyperref.sty's definition of appendix. This is exactly what was the cause of the issue in Conflict between babel, hyperref and appendix package as well, but the workaround mentioned there did not help here - we really had to address the root of the issue directly. See also Apéndices (Appendix spanish accent), How to make appendix and hyperref packages work together with cyrillic (non ASCII) characters?, Hyperref, Bookmark and Appendix packages: Getting labels inside Appendices to work.



                You should probably delete your temporary files and recompile from scratch to avoid remnants of the old code in the auxiliary files messing things up.



                You may also want to consider writing to the maintainer of appendix.sty about this issue. At least to me it seems like a good idea to use the safe string Hy@appendixstring here instead of the potentially dangerous appendixname.



                Note that I changed the loading order in your preamble a bit. hyperref should usually be the last package you load (there are a few documented exceptions like cleveref and some matters of taste, like the order together with bookmark: Which package should I load first: hyperref or bookmark?): It was loaded very (too?) early in your example.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 21 at 17:09

























                answered Nov 21 at 15:34









                moewe

                83.2k8107320




                83.2k8107320






















                    DanielTuzes is a new contributor. Be nice, and check out our Code of Conduct.










                     

                    draft saved


                    draft discarded


















                    DanielTuzes is a new contributor. Be nice, and check out our Code of Conduct.













                    DanielTuzes is a new contributor. Be nice, and check out our Code of Conduct.












                    DanielTuzes is a new contributor. Be nice, and check out our Code of Conduct.















                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461125%2fconflict-between-appendix-bookmark-hyperref-and-magyar-babel-due-to-utf8-chars%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

                    Plaza Victoria

                    Puebla de Zaragoza

                    Musa