widehat in index inside align environment does not show up properly in the index











up vote
0
down vote

favorite












Why does the widehat mathematical symbol show up as follows in the MWE below? enter image description here



documentclass{scrartcl}
usepackage{bm}
usepackage{amsmath}
newcommand*{xv}{operatorname{xv}}
usepackage[noautomatic]{imakeidx}
makeindex[intoc]

newcommand*lettergroupDefault[1]{textbf{sffamily Symbols}}
newcommand*lettergroup[1]{%
partextbf{sffamily#1}par
nopagebreak
}

begin{document}
begin{align*}
E=mc^2index{. xv@$widehat{xv}_n$}
end{align*}
printindex
end{document}









share|improve this question


















  • 2




    protectwidehat The contents of index are written to an external file which always triggers full expansion and widehat is not protected.
    – Henri Menke
    8 hours ago












  • That solved the problem, Henri, thanks. Do you want to provide it as answer?
    – Marius Hofert
    6 hours ago















up vote
0
down vote

favorite












Why does the widehat mathematical symbol show up as follows in the MWE below? enter image description here



documentclass{scrartcl}
usepackage{bm}
usepackage{amsmath}
newcommand*{xv}{operatorname{xv}}
usepackage[noautomatic]{imakeidx}
makeindex[intoc]

newcommand*lettergroupDefault[1]{textbf{sffamily Symbols}}
newcommand*lettergroup[1]{%
partextbf{sffamily#1}par
nopagebreak
}

begin{document}
begin{align*}
E=mc^2index{. xv@$widehat{xv}_n$}
end{align*}
printindex
end{document}









share|improve this question


















  • 2




    protectwidehat The contents of index are written to an external file which always triggers full expansion and widehat is not protected.
    – Henri Menke
    8 hours ago












  • That solved the problem, Henri, thanks. Do you want to provide it as answer?
    – Marius Hofert
    6 hours ago













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Why does the widehat mathematical symbol show up as follows in the MWE below? enter image description here



documentclass{scrartcl}
usepackage{bm}
usepackage{amsmath}
newcommand*{xv}{operatorname{xv}}
usepackage[noautomatic]{imakeidx}
makeindex[intoc]

newcommand*lettergroupDefault[1]{textbf{sffamily Symbols}}
newcommand*lettergroup[1]{%
partextbf{sffamily#1}par
nopagebreak
}

begin{document}
begin{align*}
E=mc^2index{. xv@$widehat{xv}_n$}
end{align*}
printindex
end{document}









share|improve this question













Why does the widehat mathematical symbol show up as follows in the MWE below? enter image description here



documentclass{scrartcl}
usepackage{bm}
usepackage{amsmath}
newcommand*{xv}{operatorname{xv}}
usepackage[noautomatic]{imakeidx}
makeindex[intoc]

newcommand*lettergroupDefault[1]{textbf{sffamily Symbols}}
newcommand*lettergroup[1]{%
partextbf{sffamily#1}par
nopagebreak
}

begin{document}
begin{align*}
E=mc^2index{. xv@$widehat{xv}_n$}
end{align*}
printindex
end{document}






indexing makeindex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









Marius Hofert

1,98812445




1,98812445








  • 2




    protectwidehat The contents of index are written to an external file which always triggers full expansion and widehat is not protected.
    – Henri Menke
    8 hours ago












  • That solved the problem, Henri, thanks. Do you want to provide it as answer?
    – Marius Hofert
    6 hours ago














  • 2




    protectwidehat The contents of index are written to an external file which always triggers full expansion and widehat is not protected.
    – Henri Menke
    8 hours ago












  • That solved the problem, Henri, thanks. Do you want to provide it as answer?
    – Marius Hofert
    6 hours ago








2




2




protectwidehat The contents of index are written to an external file which always triggers full expansion and widehat is not protected.
– Henri Menke
8 hours ago






protectwidehat The contents of index are written to an external file which always triggers full expansion and widehat is not protected.
– Henri Menke
8 hours ago














That solved the problem, Henri, thanks. Do you want to provide it as answer?
– Marius Hofert
6 hours ago




That solved the problem, Henri, thanks. Do you want to provide it as answer?
– Marius Hofert
6 hours ago










1 Answer
1






active

oldest

votes

















up vote
0
down vote













If you look in the .idx file, you will find



indexentry{. xv@$mathaccent "0362relax {xv  }_n$}{1}


which fails because " is a quoting character in .idx files, so this is interpreted as if it were mathaccent 362 changing hexadecimal into decimal.



A way out could be protectwidehat, but I'd not recommend this. The problem is that



widehat{xv}


does not behave as an operator as far as spacing is concerned, because it ends up being an Acc atom, which is later treated as an ordinary one. Try with



begin{align*}
xv A &= 2 \
hxv A &= 2 \
widehat{xv} A &= 2
end{align*}


where xv and hxv are properly defined by



DeclareMathOperator{xv}{xv}
DeclareMathOperator{hxv}{widehat{xv}}


The output is



enter image description here



and you can immediately see the problem.



Using hxv in the index command will write hxv (and similarly xv will write itself) instead of doing nasty expansions. The proposed definition of xv is to be preferred to newcommand{xv}{operatorname{xv}} also for this reason.



Beware that the same problem with " will appear with delimiters: protect also things such as lbrace.






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


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460221%2fwidehat-in-index-inside-align-environment-does-not-show-up-properly-in-the-ind%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
    0
    down vote













    If you look in the .idx file, you will find



    indexentry{. xv@$mathaccent "0362relax {xv  }_n$}{1}


    which fails because " is a quoting character in .idx files, so this is interpreted as if it were mathaccent 362 changing hexadecimal into decimal.



    A way out could be protectwidehat, but I'd not recommend this. The problem is that



    widehat{xv}


    does not behave as an operator as far as spacing is concerned, because it ends up being an Acc atom, which is later treated as an ordinary one. Try with



    begin{align*}
    xv A &= 2 \
    hxv A &= 2 \
    widehat{xv} A &= 2
    end{align*}


    where xv and hxv are properly defined by



    DeclareMathOperator{xv}{xv}
    DeclareMathOperator{hxv}{widehat{xv}}


    The output is



    enter image description here



    and you can immediately see the problem.



    Using hxv in the index command will write hxv (and similarly xv will write itself) instead of doing nasty expansions. The proposed definition of xv is to be preferred to newcommand{xv}{operatorname{xv}} also for this reason.



    Beware that the same problem with " will appear with delimiters: protect also things such as lbrace.






    share|improve this answer

























      up vote
      0
      down vote













      If you look in the .idx file, you will find



      indexentry{. xv@$mathaccent "0362relax {xv  }_n$}{1}


      which fails because " is a quoting character in .idx files, so this is interpreted as if it were mathaccent 362 changing hexadecimal into decimal.



      A way out could be protectwidehat, but I'd not recommend this. The problem is that



      widehat{xv}


      does not behave as an operator as far as spacing is concerned, because it ends up being an Acc atom, which is later treated as an ordinary one. Try with



      begin{align*}
      xv A &= 2 \
      hxv A &= 2 \
      widehat{xv} A &= 2
      end{align*}


      where xv and hxv are properly defined by



      DeclareMathOperator{xv}{xv}
      DeclareMathOperator{hxv}{widehat{xv}}


      The output is



      enter image description here



      and you can immediately see the problem.



      Using hxv in the index command will write hxv (and similarly xv will write itself) instead of doing nasty expansions. The proposed definition of xv is to be preferred to newcommand{xv}{operatorname{xv}} also for this reason.



      Beware that the same problem with " will appear with delimiters: protect also things such as lbrace.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        If you look in the .idx file, you will find



        indexentry{. xv@$mathaccent "0362relax {xv  }_n$}{1}


        which fails because " is a quoting character in .idx files, so this is interpreted as if it were mathaccent 362 changing hexadecimal into decimal.



        A way out could be protectwidehat, but I'd not recommend this. The problem is that



        widehat{xv}


        does not behave as an operator as far as spacing is concerned, because it ends up being an Acc atom, which is later treated as an ordinary one. Try with



        begin{align*}
        xv A &= 2 \
        hxv A &= 2 \
        widehat{xv} A &= 2
        end{align*}


        where xv and hxv are properly defined by



        DeclareMathOperator{xv}{xv}
        DeclareMathOperator{hxv}{widehat{xv}}


        The output is



        enter image description here



        and you can immediately see the problem.



        Using hxv in the index command will write hxv (and similarly xv will write itself) instead of doing nasty expansions. The proposed definition of xv is to be preferred to newcommand{xv}{operatorname{xv}} also for this reason.



        Beware that the same problem with " will appear with delimiters: protect also things such as lbrace.






        share|improve this answer












        If you look in the .idx file, you will find



        indexentry{. xv@$mathaccent "0362relax {xv  }_n$}{1}


        which fails because " is a quoting character in .idx files, so this is interpreted as if it were mathaccent 362 changing hexadecimal into decimal.



        A way out could be protectwidehat, but I'd not recommend this. The problem is that



        widehat{xv}


        does not behave as an operator as far as spacing is concerned, because it ends up being an Acc atom, which is later treated as an ordinary one. Try with



        begin{align*}
        xv A &= 2 \
        hxv A &= 2 \
        widehat{xv} A &= 2
        end{align*}


        where xv and hxv are properly defined by



        DeclareMathOperator{xv}{xv}
        DeclareMathOperator{hxv}{widehat{xv}}


        The output is



        enter image description here



        and you can immediately see the problem.



        Using hxv in the index command will write hxv (and similarly xv will write itself) instead of doing nasty expansions. The proposed definition of xv is to be preferred to newcommand{xv}{operatorname{xv}} also for this reason.



        Beware that the same problem with " will appear with delimiters: protect also things such as lbrace.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 1 hour ago









        egreg

        697k8518513118




        697k8518513118






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460221%2fwidehat-in-index-inside-align-environment-does-not-show-up-properly-in-the-ind%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

            Entries order in /etc/network/interfaces

            新発田市

            Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)