glossaries use of sort key












1















after reading the manual of the glossaries packages I was under the impression that when you use the sort key that it would be sorted alphabetically according to the text given in this sort key. However, this MWE does not achieve this (in reality of course I have much more symbols so I really need the automatic sorting and it would take to long to define them in the correct order when I define them)



documentclass{report}
usepackage{lipsum}
usepackage{hyperref}
usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

makenoidxglossaries

newglossaryentry{thetab}
{%
name={$Theta_{b}$},
description={temperature coefficient for b},
sort=temperature coefficient for b ,
}

newglossaryentry{thetaa}
{%
name={$Theta_{a}$},
description={temperature coefficient for a},
sort=temperature coefficient for a,
}

newglossaryentry{thetade}
{%
name={$Theta_{de}$},
description={temperature coefficient for de},
sort=temperature coefficient for de,
}

newglossaryentry{thetaOP}
{%
name={$Theta_{OP}$},
description={temperature coefficient for OP},
sort=temperature coefficient for op,
}

begin{document}

printnoidxglossary[sort=standard,title={List of Symbols}]

chapter{first chapter}
lipsum

testing gls{thetab} and gls{thetaa}

some more references gls{thetade} and gls{thetaOP}

end{document}


which gives this result:



enter image description here



where I would have expected this order if sorted alphabetically:



temperature coeffcient for a



temperature coeffcient for b



temperature coeffcient for de



temperature coeffcient for OP



what am I doing wrong?










share|improve this question























  • i think that the string for the "sort" key needs to be in braces, like the other argument values.

    – barbara beeton
    Apr 13 '16 at 15:24











  • @barbara: you are probably right that it is better to put them in braces, but I have tested it and it does not change the order of the sorting unfortunately

    – Ingrid
    Apr 13 '16 at 15:40











  • did you make sure that makeindex ran again before you ran the last iteration of latex? (that's the same order of steps that would be involved if you made a change to the sort of an index; the glossaries package takes advantage of the makeindex mechanism, which is a multi-step process.)

    – barbara beeton
    Apr 13 '16 at 15:44











  • Remove the spaces: sort={temperaturecoefficientfora}

    – Ulrike Fischer
    Apr 13 '16 at 15:44











  • @barbarabeeton Ingrid is using the noidx option, which means that the sorting is done by tex and not an external tool.

    – Ulrike Fischer
    Apr 13 '16 at 15:44
















1















after reading the manual of the glossaries packages I was under the impression that when you use the sort key that it would be sorted alphabetically according to the text given in this sort key. However, this MWE does not achieve this (in reality of course I have much more symbols so I really need the automatic sorting and it would take to long to define them in the correct order when I define them)



documentclass{report}
usepackage{lipsum}
usepackage{hyperref}
usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

makenoidxglossaries

newglossaryentry{thetab}
{%
name={$Theta_{b}$},
description={temperature coefficient for b},
sort=temperature coefficient for b ,
}

newglossaryentry{thetaa}
{%
name={$Theta_{a}$},
description={temperature coefficient for a},
sort=temperature coefficient for a,
}

newglossaryentry{thetade}
{%
name={$Theta_{de}$},
description={temperature coefficient for de},
sort=temperature coefficient for de,
}

newglossaryentry{thetaOP}
{%
name={$Theta_{OP}$},
description={temperature coefficient for OP},
sort=temperature coefficient for op,
}

begin{document}

printnoidxglossary[sort=standard,title={List of Symbols}]

chapter{first chapter}
lipsum

testing gls{thetab} and gls{thetaa}

some more references gls{thetade} and gls{thetaOP}

end{document}


which gives this result:



enter image description here



where I would have expected this order if sorted alphabetically:



temperature coeffcient for a



temperature coeffcient for b



temperature coeffcient for de



temperature coeffcient for OP



what am I doing wrong?










share|improve this question























  • i think that the string for the "sort" key needs to be in braces, like the other argument values.

    – barbara beeton
    Apr 13 '16 at 15:24











  • @barbara: you are probably right that it is better to put them in braces, but I have tested it and it does not change the order of the sorting unfortunately

    – Ingrid
    Apr 13 '16 at 15:40











  • did you make sure that makeindex ran again before you ran the last iteration of latex? (that's the same order of steps that would be involved if you made a change to the sort of an index; the glossaries package takes advantage of the makeindex mechanism, which is a multi-step process.)

    – barbara beeton
    Apr 13 '16 at 15:44











  • Remove the spaces: sort={temperaturecoefficientfora}

    – Ulrike Fischer
    Apr 13 '16 at 15:44











  • @barbarabeeton Ingrid is using the noidx option, which means that the sorting is done by tex and not an external tool.

    – Ulrike Fischer
    Apr 13 '16 at 15:44














1












1








1


1






after reading the manual of the glossaries packages I was under the impression that when you use the sort key that it would be sorted alphabetically according to the text given in this sort key. However, this MWE does not achieve this (in reality of course I have much more symbols so I really need the automatic sorting and it would take to long to define them in the correct order when I define them)



documentclass{report}
usepackage{lipsum}
usepackage{hyperref}
usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

makenoidxglossaries

newglossaryentry{thetab}
{%
name={$Theta_{b}$},
description={temperature coefficient for b},
sort=temperature coefficient for b ,
}

newglossaryentry{thetaa}
{%
name={$Theta_{a}$},
description={temperature coefficient for a},
sort=temperature coefficient for a,
}

newglossaryentry{thetade}
{%
name={$Theta_{de}$},
description={temperature coefficient for de},
sort=temperature coefficient for de,
}

newglossaryentry{thetaOP}
{%
name={$Theta_{OP}$},
description={temperature coefficient for OP},
sort=temperature coefficient for op,
}

begin{document}

printnoidxglossary[sort=standard,title={List of Symbols}]

chapter{first chapter}
lipsum

testing gls{thetab} and gls{thetaa}

some more references gls{thetade} and gls{thetaOP}

end{document}


which gives this result:



enter image description here



where I would have expected this order if sorted alphabetically:



temperature coeffcient for a



temperature coeffcient for b



temperature coeffcient for de



temperature coeffcient for OP



what am I doing wrong?










share|improve this question














after reading the manual of the glossaries packages I was under the impression that when you use the sort key that it would be sorted alphabetically according to the text given in this sort key. However, this MWE does not achieve this (in reality of course I have much more symbols so I really need the automatic sorting and it would take to long to define them in the correct order when I define them)



documentclass{report}
usepackage{lipsum}
usepackage{hyperref}
usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

makenoidxglossaries

newglossaryentry{thetab}
{%
name={$Theta_{b}$},
description={temperature coefficient for b},
sort=temperature coefficient for b ,
}

newglossaryentry{thetaa}
{%
name={$Theta_{a}$},
description={temperature coefficient for a},
sort=temperature coefficient for a,
}

newglossaryentry{thetade}
{%
name={$Theta_{de}$},
description={temperature coefficient for de},
sort=temperature coefficient for de,
}

newglossaryentry{thetaOP}
{%
name={$Theta_{OP}$},
description={temperature coefficient for OP},
sort=temperature coefficient for op,
}

begin{document}

printnoidxglossary[sort=standard,title={List of Symbols}]

chapter{first chapter}
lipsum

testing gls{thetab} and gls{thetaa}

some more references gls{thetade} and gls{thetaOP}

end{document}


which gives this result:



enter image description here



where I would have expected this order if sorted alphabetically:



temperature coeffcient for a



temperature coeffcient for b



temperature coeffcient for de



temperature coeffcient for OP



what am I doing wrong?







glossaries sorting






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 13 '16 at 15:08









IngridIngrid

69110




69110













  • i think that the string for the "sort" key needs to be in braces, like the other argument values.

    – barbara beeton
    Apr 13 '16 at 15:24











  • @barbara: you are probably right that it is better to put them in braces, but I have tested it and it does not change the order of the sorting unfortunately

    – Ingrid
    Apr 13 '16 at 15:40











  • did you make sure that makeindex ran again before you ran the last iteration of latex? (that's the same order of steps that would be involved if you made a change to the sort of an index; the glossaries package takes advantage of the makeindex mechanism, which is a multi-step process.)

    – barbara beeton
    Apr 13 '16 at 15:44











  • Remove the spaces: sort={temperaturecoefficientfora}

    – Ulrike Fischer
    Apr 13 '16 at 15:44











  • @barbarabeeton Ingrid is using the noidx option, which means that the sorting is done by tex and not an external tool.

    – Ulrike Fischer
    Apr 13 '16 at 15:44



















  • i think that the string for the "sort" key needs to be in braces, like the other argument values.

    – barbara beeton
    Apr 13 '16 at 15:24











  • @barbara: you are probably right that it is better to put them in braces, but I have tested it and it does not change the order of the sorting unfortunately

    – Ingrid
    Apr 13 '16 at 15:40











  • did you make sure that makeindex ran again before you ran the last iteration of latex? (that's the same order of steps that would be involved if you made a change to the sort of an index; the glossaries package takes advantage of the makeindex mechanism, which is a multi-step process.)

    – barbara beeton
    Apr 13 '16 at 15:44











  • Remove the spaces: sort={temperaturecoefficientfora}

    – Ulrike Fischer
    Apr 13 '16 at 15:44











  • @barbarabeeton Ingrid is using the noidx option, which means that the sorting is done by tex and not an external tool.

    – Ulrike Fischer
    Apr 13 '16 at 15:44

















i think that the string for the "sort" key needs to be in braces, like the other argument values.

– barbara beeton
Apr 13 '16 at 15:24





i think that the string for the "sort" key needs to be in braces, like the other argument values.

– barbara beeton
Apr 13 '16 at 15:24













@barbara: you are probably right that it is better to put them in braces, but I have tested it and it does not change the order of the sorting unfortunately

– Ingrid
Apr 13 '16 at 15:40





@barbara: you are probably right that it is better to put them in braces, but I have tested it and it does not change the order of the sorting unfortunately

– Ingrid
Apr 13 '16 at 15:40













did you make sure that makeindex ran again before you ran the last iteration of latex? (that's the same order of steps that would be involved if you made a change to the sort of an index; the glossaries package takes advantage of the makeindex mechanism, which is a multi-step process.)

– barbara beeton
Apr 13 '16 at 15:44





did you make sure that makeindex ran again before you ran the last iteration of latex? (that's the same order of steps that would be involved if you made a change to the sort of an index; the glossaries package takes advantage of the makeindex mechanism, which is a multi-step process.)

– barbara beeton
Apr 13 '16 at 15:44













Remove the spaces: sort={temperaturecoefficientfora}

– Ulrike Fischer
Apr 13 '16 at 15:44





Remove the spaces: sort={temperaturecoefficientfora}

– Ulrike Fischer
Apr 13 '16 at 15:44













@barbarabeeton Ingrid is using the noidx option, which means that the sorting is done by tex and not an external tool.

– Ulrike Fischer
Apr 13 '16 at 15:44





@barbarabeeton Ingrid is using the noidx option, which means that the sorting is done by tex and not an external tool.

– Ulrike Fischer
Apr 13 '16 at 15:44










2 Answers
2






active

oldest

votes


















1














I'm not sure why the standard sort order isn't working, but it works fine if you switch to letter:



documentclass{report}
usepackage{lipsum}
usepackage{hyperref}
usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

makenoidxglossaries

newglossaryentry{thetab}
{%
name={$Theta_{b}$},
description={temperature coefficient for b},
sort=temperature coefficient for b,
}

newglossaryentry{thetaa}
{%
name={$Theta_{a}$},
description={temperature coefficient for a},
sort=temperature coefficient for a,
}

newglossaryentry{thetade}
{%
name={$Theta_{de}$},
description={temperature coefficient for de},
sort=temperature coefficient for de,
}

newglossaryentry{thetaOP}
{%
name={$Theta_{OP}$},
description={temperature coefficient for OP},
sort=temperature coefficient for op,
}

begin{document}

printnoidxglossary[sort=letter,title={List of Symbols}]

chapter{first chapter}
lipsum

testing gls{thetab} and gls{thetaa}

some more references gls{thetade} and gls{thetaOP}

end{document}


This produces:



image of glossary



Incidentally, if you want to sort by a different field (the description in this case), you can redefine the hook that sets the value of the sort key. For example:



documentclass{report}
usepackage{lipsum}
usepackage{hyperref}
usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

makenoidxglossaries

makeatletter
renewcommand{glsprestandardsort}[3]{%
protected@edef#1{glsentrydesc{#3}}%
}
makeatother

newglossaryentry{thetab}
{%
name={$Theta_{b}$},
description={temperature coefficient for b}
}

newglossaryentry{thetaa}
{%
name={$Theta_{a}$},
description={temperature coefficient for a}
}

newglossaryentry{thetade}
{%
name={$Theta_{de}$},
description={temperature coefficient for de}
}

newglossaryentry{thetaOP}
{%
name={$Theta_{OP}$},
description={temperature coefficient for OP}
}

begin{document}

printnoidxglossary[sort=letter,title={List of Symbols}]

chapter{first chapter}
lipsum

testing gls{thetab} and gls{thetaa}

some more references gls{thetade} and gls{thetaOP}

end{document}


Edit:



A better redefinition of glsprestandardsort is:



glssanitizesorttrue

renewcommand{glsprestandardsort}[3]{%
glsfieldfetch{#3}{desc}{#1}%
glsdosanitizesort
}


(This no longer needs the makeatletter...makeatother part.)



The glssanitizesorttrue bit will make glsdosanitizesort apply @onelevel@sanitize to the sort field, which will allow commands like si to appear in the description (but it will apply the same logic as makeindex and treat si as the sequence of characters , s and i).



The second argument of glsprestandardsort is the glossary type, so you can test it to vary the way the sort field is set according to the glossary. For example:



renewcommand{glsprestandardsort}[3]{%
ifthenelse{equal{#2}{main}}%
{%
glsfieldfetch{#3}{desc}{#1}%
}{}%
glsdosanitizesort
}





share|improve this answer


























  • thanks, this last solution is indeed much more elegant and achieves what I want to do much easier. It works in the MWE, but in my large document, it gives errors as sometimes I am using si{} in the description which apparently is no longer allowed

    – Ingrid
    Apr 14 '16 at 8:48











  • @Ingrid updated my answer to allow for si.

    – Nicola Talbot
    Apr 14 '16 at 9:20











  • thanks works like a charm. I am encountering another problem though. I am also having a list of acronyms and now they are also sorted based on the description whereas I would like this list to be sorted alphabetically based on their acronym. Is it possible with this method to have two different methods for each list?

    – Ingrid
    Apr 14 '16 at 14:06











  • @Ingrid Yes, I've updated my answer to test for the glossary type.

    – Nicola Talbot
    Apr 14 '16 at 17:37











  • thanks for your very quick reply's. They are really appreciated since I am running against a deadline! I clearly still have a lot to learn as I can currently only apply the standard stuff but am clueless about the stuff behind the scenes which is of course necessary when you want to do the cool stuff

    – Ingrid
    Apr 15 '16 at 8:07





















2














Remove the spaces in the sort key values:



documentclass{report}
usepackage{lipsum}
usepackage{hyperref}
usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

makenoidxglossaries

newglossaryentry{thetab}
{%
name={$Theta_{b}$},
description={temperature coefficient for b},
sort=temperaturecoefficientforb,
}

newglossaryentry{thetaa}
{%
name={$Theta_{a}$},
description={temperature coefficient for a},
sort=temperaturecoefficientfora,
}

newglossaryentry{thetade}
{%
name={$Theta_{de}$},
description={temperature coefficient for de},
sort=temperaturecoefficientforde,
}

newglossaryentry{thetaOP}
{%
name={$Theta_{OP}$},
description={temperature coefficient for OP},
sort=temperaturecoefficientforop,
}

begin{document}

printnoidxglossary[sort=standard,title={List of Symbols}]

chapter{first chapter}
lipsum

testing gls{thetab} and gls{thetaa}

some more references gls{thetade} and gls{thetaOP}

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%2f304092%2fglossaries-use-of-sort-key%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    I'm not sure why the standard sort order isn't working, but it works fine if you switch to letter:



    documentclass{report}
    usepackage{lipsum}
    usepackage{hyperref}
    usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

    makenoidxglossaries

    newglossaryentry{thetab}
    {%
    name={$Theta_{b}$},
    description={temperature coefficient for b},
    sort=temperature coefficient for b,
    }

    newglossaryentry{thetaa}
    {%
    name={$Theta_{a}$},
    description={temperature coefficient for a},
    sort=temperature coefficient for a,
    }

    newglossaryentry{thetade}
    {%
    name={$Theta_{de}$},
    description={temperature coefficient for de},
    sort=temperature coefficient for de,
    }

    newglossaryentry{thetaOP}
    {%
    name={$Theta_{OP}$},
    description={temperature coefficient for OP},
    sort=temperature coefficient for op,
    }

    begin{document}

    printnoidxglossary[sort=letter,title={List of Symbols}]

    chapter{first chapter}
    lipsum

    testing gls{thetab} and gls{thetaa}

    some more references gls{thetade} and gls{thetaOP}

    end{document}


    This produces:



    image of glossary



    Incidentally, if you want to sort by a different field (the description in this case), you can redefine the hook that sets the value of the sort key. For example:



    documentclass{report}
    usepackage{lipsum}
    usepackage{hyperref}
    usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

    makenoidxglossaries

    makeatletter
    renewcommand{glsprestandardsort}[3]{%
    protected@edef#1{glsentrydesc{#3}}%
    }
    makeatother

    newglossaryentry{thetab}
    {%
    name={$Theta_{b}$},
    description={temperature coefficient for b}
    }

    newglossaryentry{thetaa}
    {%
    name={$Theta_{a}$},
    description={temperature coefficient for a}
    }

    newglossaryentry{thetade}
    {%
    name={$Theta_{de}$},
    description={temperature coefficient for de}
    }

    newglossaryentry{thetaOP}
    {%
    name={$Theta_{OP}$},
    description={temperature coefficient for OP}
    }

    begin{document}

    printnoidxglossary[sort=letter,title={List of Symbols}]

    chapter{first chapter}
    lipsum

    testing gls{thetab} and gls{thetaa}

    some more references gls{thetade} and gls{thetaOP}

    end{document}


    Edit:



    A better redefinition of glsprestandardsort is:



    glssanitizesorttrue

    renewcommand{glsprestandardsort}[3]{%
    glsfieldfetch{#3}{desc}{#1}%
    glsdosanitizesort
    }


    (This no longer needs the makeatletter...makeatother part.)



    The glssanitizesorttrue bit will make glsdosanitizesort apply @onelevel@sanitize to the sort field, which will allow commands like si to appear in the description (but it will apply the same logic as makeindex and treat si as the sequence of characters , s and i).



    The second argument of glsprestandardsort is the glossary type, so you can test it to vary the way the sort field is set according to the glossary. For example:



    renewcommand{glsprestandardsort}[3]{%
    ifthenelse{equal{#2}{main}}%
    {%
    glsfieldfetch{#3}{desc}{#1}%
    }{}%
    glsdosanitizesort
    }





    share|improve this answer


























    • thanks, this last solution is indeed much more elegant and achieves what I want to do much easier. It works in the MWE, but in my large document, it gives errors as sometimes I am using si{} in the description which apparently is no longer allowed

      – Ingrid
      Apr 14 '16 at 8:48











    • @Ingrid updated my answer to allow for si.

      – Nicola Talbot
      Apr 14 '16 at 9:20











    • thanks works like a charm. I am encountering another problem though. I am also having a list of acronyms and now they are also sorted based on the description whereas I would like this list to be sorted alphabetically based on their acronym. Is it possible with this method to have two different methods for each list?

      – Ingrid
      Apr 14 '16 at 14:06











    • @Ingrid Yes, I've updated my answer to test for the glossary type.

      – Nicola Talbot
      Apr 14 '16 at 17:37











    • thanks for your very quick reply's. They are really appreciated since I am running against a deadline! I clearly still have a lot to learn as I can currently only apply the standard stuff but am clueless about the stuff behind the scenes which is of course necessary when you want to do the cool stuff

      – Ingrid
      Apr 15 '16 at 8:07


















    1














    I'm not sure why the standard sort order isn't working, but it works fine if you switch to letter:



    documentclass{report}
    usepackage{lipsum}
    usepackage{hyperref}
    usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

    makenoidxglossaries

    newglossaryentry{thetab}
    {%
    name={$Theta_{b}$},
    description={temperature coefficient for b},
    sort=temperature coefficient for b,
    }

    newglossaryentry{thetaa}
    {%
    name={$Theta_{a}$},
    description={temperature coefficient for a},
    sort=temperature coefficient for a,
    }

    newglossaryentry{thetade}
    {%
    name={$Theta_{de}$},
    description={temperature coefficient for de},
    sort=temperature coefficient for de,
    }

    newglossaryentry{thetaOP}
    {%
    name={$Theta_{OP}$},
    description={temperature coefficient for OP},
    sort=temperature coefficient for op,
    }

    begin{document}

    printnoidxglossary[sort=letter,title={List of Symbols}]

    chapter{first chapter}
    lipsum

    testing gls{thetab} and gls{thetaa}

    some more references gls{thetade} and gls{thetaOP}

    end{document}


    This produces:



    image of glossary



    Incidentally, if you want to sort by a different field (the description in this case), you can redefine the hook that sets the value of the sort key. For example:



    documentclass{report}
    usepackage{lipsum}
    usepackage{hyperref}
    usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

    makenoidxglossaries

    makeatletter
    renewcommand{glsprestandardsort}[3]{%
    protected@edef#1{glsentrydesc{#3}}%
    }
    makeatother

    newglossaryentry{thetab}
    {%
    name={$Theta_{b}$},
    description={temperature coefficient for b}
    }

    newglossaryentry{thetaa}
    {%
    name={$Theta_{a}$},
    description={temperature coefficient for a}
    }

    newglossaryentry{thetade}
    {%
    name={$Theta_{de}$},
    description={temperature coefficient for de}
    }

    newglossaryentry{thetaOP}
    {%
    name={$Theta_{OP}$},
    description={temperature coefficient for OP}
    }

    begin{document}

    printnoidxglossary[sort=letter,title={List of Symbols}]

    chapter{first chapter}
    lipsum

    testing gls{thetab} and gls{thetaa}

    some more references gls{thetade} and gls{thetaOP}

    end{document}


    Edit:



    A better redefinition of glsprestandardsort is:



    glssanitizesorttrue

    renewcommand{glsprestandardsort}[3]{%
    glsfieldfetch{#3}{desc}{#1}%
    glsdosanitizesort
    }


    (This no longer needs the makeatletter...makeatother part.)



    The glssanitizesorttrue bit will make glsdosanitizesort apply @onelevel@sanitize to the sort field, which will allow commands like si to appear in the description (but it will apply the same logic as makeindex and treat si as the sequence of characters , s and i).



    The second argument of glsprestandardsort is the glossary type, so you can test it to vary the way the sort field is set according to the glossary. For example:



    renewcommand{glsprestandardsort}[3]{%
    ifthenelse{equal{#2}{main}}%
    {%
    glsfieldfetch{#3}{desc}{#1}%
    }{}%
    glsdosanitizesort
    }





    share|improve this answer


























    • thanks, this last solution is indeed much more elegant and achieves what I want to do much easier. It works in the MWE, but in my large document, it gives errors as sometimes I am using si{} in the description which apparently is no longer allowed

      – Ingrid
      Apr 14 '16 at 8:48











    • @Ingrid updated my answer to allow for si.

      – Nicola Talbot
      Apr 14 '16 at 9:20











    • thanks works like a charm. I am encountering another problem though. I am also having a list of acronyms and now they are also sorted based on the description whereas I would like this list to be sorted alphabetically based on their acronym. Is it possible with this method to have two different methods for each list?

      – Ingrid
      Apr 14 '16 at 14:06











    • @Ingrid Yes, I've updated my answer to test for the glossary type.

      – Nicola Talbot
      Apr 14 '16 at 17:37











    • thanks for your very quick reply's. They are really appreciated since I am running against a deadline! I clearly still have a lot to learn as I can currently only apply the standard stuff but am clueless about the stuff behind the scenes which is of course necessary when you want to do the cool stuff

      – Ingrid
      Apr 15 '16 at 8:07
















    1












    1








    1







    I'm not sure why the standard sort order isn't working, but it works fine if you switch to letter:



    documentclass{report}
    usepackage{lipsum}
    usepackage{hyperref}
    usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

    makenoidxglossaries

    newglossaryentry{thetab}
    {%
    name={$Theta_{b}$},
    description={temperature coefficient for b},
    sort=temperature coefficient for b,
    }

    newglossaryentry{thetaa}
    {%
    name={$Theta_{a}$},
    description={temperature coefficient for a},
    sort=temperature coefficient for a,
    }

    newglossaryentry{thetade}
    {%
    name={$Theta_{de}$},
    description={temperature coefficient for de},
    sort=temperature coefficient for de,
    }

    newglossaryentry{thetaOP}
    {%
    name={$Theta_{OP}$},
    description={temperature coefficient for OP},
    sort=temperature coefficient for op,
    }

    begin{document}

    printnoidxglossary[sort=letter,title={List of Symbols}]

    chapter{first chapter}
    lipsum

    testing gls{thetab} and gls{thetaa}

    some more references gls{thetade} and gls{thetaOP}

    end{document}


    This produces:



    image of glossary



    Incidentally, if you want to sort by a different field (the description in this case), you can redefine the hook that sets the value of the sort key. For example:



    documentclass{report}
    usepackage{lipsum}
    usepackage{hyperref}
    usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

    makenoidxglossaries

    makeatletter
    renewcommand{glsprestandardsort}[3]{%
    protected@edef#1{glsentrydesc{#3}}%
    }
    makeatother

    newglossaryentry{thetab}
    {%
    name={$Theta_{b}$},
    description={temperature coefficient for b}
    }

    newglossaryentry{thetaa}
    {%
    name={$Theta_{a}$},
    description={temperature coefficient for a}
    }

    newglossaryentry{thetade}
    {%
    name={$Theta_{de}$},
    description={temperature coefficient for de}
    }

    newglossaryentry{thetaOP}
    {%
    name={$Theta_{OP}$},
    description={temperature coefficient for OP}
    }

    begin{document}

    printnoidxglossary[sort=letter,title={List of Symbols}]

    chapter{first chapter}
    lipsum

    testing gls{thetab} and gls{thetaa}

    some more references gls{thetade} and gls{thetaOP}

    end{document}


    Edit:



    A better redefinition of glsprestandardsort is:



    glssanitizesorttrue

    renewcommand{glsprestandardsort}[3]{%
    glsfieldfetch{#3}{desc}{#1}%
    glsdosanitizesort
    }


    (This no longer needs the makeatletter...makeatother part.)



    The glssanitizesorttrue bit will make glsdosanitizesort apply @onelevel@sanitize to the sort field, which will allow commands like si to appear in the description (but it will apply the same logic as makeindex and treat si as the sequence of characters , s and i).



    The second argument of glsprestandardsort is the glossary type, so you can test it to vary the way the sort field is set according to the glossary. For example:



    renewcommand{glsprestandardsort}[3]{%
    ifthenelse{equal{#2}{main}}%
    {%
    glsfieldfetch{#3}{desc}{#1}%
    }{}%
    glsdosanitizesort
    }





    share|improve this answer















    I'm not sure why the standard sort order isn't working, but it works fine if you switch to letter:



    documentclass{report}
    usepackage{lipsum}
    usepackage{hyperref}
    usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

    makenoidxglossaries

    newglossaryentry{thetab}
    {%
    name={$Theta_{b}$},
    description={temperature coefficient for b},
    sort=temperature coefficient for b,
    }

    newglossaryentry{thetaa}
    {%
    name={$Theta_{a}$},
    description={temperature coefficient for a},
    sort=temperature coefficient for a,
    }

    newglossaryentry{thetade}
    {%
    name={$Theta_{de}$},
    description={temperature coefficient for de},
    sort=temperature coefficient for de,
    }

    newglossaryentry{thetaOP}
    {%
    name={$Theta_{OP}$},
    description={temperature coefficient for OP},
    sort=temperature coefficient for op,
    }

    begin{document}

    printnoidxglossary[sort=letter,title={List of Symbols}]

    chapter{first chapter}
    lipsum

    testing gls{thetab} and gls{thetaa}

    some more references gls{thetade} and gls{thetaOP}

    end{document}


    This produces:



    image of glossary



    Incidentally, if you want to sort by a different field (the description in this case), you can redefine the hook that sets the value of the sort key. For example:



    documentclass{report}
    usepackage{lipsum}
    usepackage{hyperref}
    usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

    makenoidxglossaries

    makeatletter
    renewcommand{glsprestandardsort}[3]{%
    protected@edef#1{glsentrydesc{#3}}%
    }
    makeatother

    newglossaryentry{thetab}
    {%
    name={$Theta_{b}$},
    description={temperature coefficient for b}
    }

    newglossaryentry{thetaa}
    {%
    name={$Theta_{a}$},
    description={temperature coefficient for a}
    }

    newglossaryentry{thetade}
    {%
    name={$Theta_{de}$},
    description={temperature coefficient for de}
    }

    newglossaryentry{thetaOP}
    {%
    name={$Theta_{OP}$},
    description={temperature coefficient for OP}
    }

    begin{document}

    printnoidxglossary[sort=letter,title={List of Symbols}]

    chapter{first chapter}
    lipsum

    testing gls{thetab} and gls{thetaa}

    some more references gls{thetade} and gls{thetaOP}

    end{document}


    Edit:



    A better redefinition of glsprestandardsort is:



    glssanitizesorttrue

    renewcommand{glsprestandardsort}[3]{%
    glsfieldfetch{#3}{desc}{#1}%
    glsdosanitizesort
    }


    (This no longer needs the makeatletter...makeatother part.)



    The glssanitizesorttrue bit will make glsdosanitizesort apply @onelevel@sanitize to the sort field, which will allow commands like si to appear in the description (but it will apply the same logic as makeindex and treat si as the sequence of characters , s and i).



    The second argument of glsprestandardsort is the glossary type, so you can test it to vary the way the sort field is set according to the glossary. For example:



    renewcommand{glsprestandardsort}[3]{%
    ifthenelse{equal{#2}{main}}%
    {%
    glsfieldfetch{#3}{desc}{#1}%
    }{}%
    glsdosanitizesort
    }






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 14 '16 at 17:36

























    answered Apr 13 '16 at 16:08









    Nicola TalbotNicola Talbot

    34.3k259105




    34.3k259105













    • thanks, this last solution is indeed much more elegant and achieves what I want to do much easier. It works in the MWE, but in my large document, it gives errors as sometimes I am using si{} in the description which apparently is no longer allowed

      – Ingrid
      Apr 14 '16 at 8:48











    • @Ingrid updated my answer to allow for si.

      – Nicola Talbot
      Apr 14 '16 at 9:20











    • thanks works like a charm. I am encountering another problem though. I am also having a list of acronyms and now they are also sorted based on the description whereas I would like this list to be sorted alphabetically based on their acronym. Is it possible with this method to have two different methods for each list?

      – Ingrid
      Apr 14 '16 at 14:06











    • @Ingrid Yes, I've updated my answer to test for the glossary type.

      – Nicola Talbot
      Apr 14 '16 at 17:37











    • thanks for your very quick reply's. They are really appreciated since I am running against a deadline! I clearly still have a lot to learn as I can currently only apply the standard stuff but am clueless about the stuff behind the scenes which is of course necessary when you want to do the cool stuff

      – Ingrid
      Apr 15 '16 at 8:07





















    • thanks, this last solution is indeed much more elegant and achieves what I want to do much easier. It works in the MWE, but in my large document, it gives errors as sometimes I am using si{} in the description which apparently is no longer allowed

      – Ingrid
      Apr 14 '16 at 8:48











    • @Ingrid updated my answer to allow for si.

      – Nicola Talbot
      Apr 14 '16 at 9:20











    • thanks works like a charm. I am encountering another problem though. I am also having a list of acronyms and now they are also sorted based on the description whereas I would like this list to be sorted alphabetically based on their acronym. Is it possible with this method to have two different methods for each list?

      – Ingrid
      Apr 14 '16 at 14:06











    • @Ingrid Yes, I've updated my answer to test for the glossary type.

      – Nicola Talbot
      Apr 14 '16 at 17:37











    • thanks for your very quick reply's. They are really appreciated since I am running against a deadline! I clearly still have a lot to learn as I can currently only apply the standard stuff but am clueless about the stuff behind the scenes which is of course necessary when you want to do the cool stuff

      – Ingrid
      Apr 15 '16 at 8:07



















    thanks, this last solution is indeed much more elegant and achieves what I want to do much easier. It works in the MWE, but in my large document, it gives errors as sometimes I am using si{} in the description which apparently is no longer allowed

    – Ingrid
    Apr 14 '16 at 8:48





    thanks, this last solution is indeed much more elegant and achieves what I want to do much easier. It works in the MWE, but in my large document, it gives errors as sometimes I am using si{} in the description which apparently is no longer allowed

    – Ingrid
    Apr 14 '16 at 8:48













    @Ingrid updated my answer to allow for si.

    – Nicola Talbot
    Apr 14 '16 at 9:20





    @Ingrid updated my answer to allow for si.

    – Nicola Talbot
    Apr 14 '16 at 9:20













    thanks works like a charm. I am encountering another problem though. I am also having a list of acronyms and now they are also sorted based on the description whereas I would like this list to be sorted alphabetically based on their acronym. Is it possible with this method to have two different methods for each list?

    – Ingrid
    Apr 14 '16 at 14:06





    thanks works like a charm. I am encountering another problem though. I am also having a list of acronyms and now they are also sorted based on the description whereas I would like this list to be sorted alphabetically based on their acronym. Is it possible with this method to have two different methods for each list?

    – Ingrid
    Apr 14 '16 at 14:06













    @Ingrid Yes, I've updated my answer to test for the glossary type.

    – Nicola Talbot
    Apr 14 '16 at 17:37





    @Ingrid Yes, I've updated my answer to test for the glossary type.

    – Nicola Talbot
    Apr 14 '16 at 17:37













    thanks for your very quick reply's. They are really appreciated since I am running against a deadline! I clearly still have a lot to learn as I can currently only apply the standard stuff but am clueless about the stuff behind the scenes which is of course necessary when you want to do the cool stuff

    – Ingrid
    Apr 15 '16 at 8:07







    thanks for your very quick reply's. They are really appreciated since I am running against a deadline! I clearly still have a lot to learn as I can currently only apply the standard stuff but am clueless about the stuff behind the scenes which is of course necessary when you want to do the cool stuff

    – Ingrid
    Apr 15 '16 at 8:07













    2














    Remove the spaces in the sort key values:



    documentclass{report}
    usepackage{lipsum}
    usepackage{hyperref}
    usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

    makenoidxglossaries

    newglossaryentry{thetab}
    {%
    name={$Theta_{b}$},
    description={temperature coefficient for b},
    sort=temperaturecoefficientforb,
    }

    newglossaryentry{thetaa}
    {%
    name={$Theta_{a}$},
    description={temperature coefficient for a},
    sort=temperaturecoefficientfora,
    }

    newglossaryentry{thetade}
    {%
    name={$Theta_{de}$},
    description={temperature coefficient for de},
    sort=temperaturecoefficientforde,
    }

    newglossaryentry{thetaOP}
    {%
    name={$Theta_{OP}$},
    description={temperature coefficient for OP},
    sort=temperaturecoefficientforop,
    }

    begin{document}

    printnoidxglossary[sort=standard,title={List of Symbols}]

    chapter{first chapter}
    lipsum

    testing gls{thetab} and gls{thetaa}

    some more references gls{thetade} and gls{thetaOP}

    end{document}


    enter image description here






    share|improve this answer




























      2














      Remove the spaces in the sort key values:



      documentclass{report}
      usepackage{lipsum}
      usepackage{hyperref}
      usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

      makenoidxglossaries

      newglossaryentry{thetab}
      {%
      name={$Theta_{b}$},
      description={temperature coefficient for b},
      sort=temperaturecoefficientforb,
      }

      newglossaryentry{thetaa}
      {%
      name={$Theta_{a}$},
      description={temperature coefficient for a},
      sort=temperaturecoefficientfora,
      }

      newglossaryentry{thetade}
      {%
      name={$Theta_{de}$},
      description={temperature coefficient for de},
      sort=temperaturecoefficientforde,
      }

      newglossaryentry{thetaOP}
      {%
      name={$Theta_{OP}$},
      description={temperature coefficient for OP},
      sort=temperaturecoefficientforop,
      }

      begin{document}

      printnoidxglossary[sort=standard,title={List of Symbols}]

      chapter{first chapter}
      lipsum

      testing gls{thetab} and gls{thetaa}

      some more references gls{thetade} and gls{thetaOP}

      end{document}


      enter image description here






      share|improve this answer


























        2












        2








        2







        Remove the spaces in the sort key values:



        documentclass{report}
        usepackage{lipsum}
        usepackage{hyperref}
        usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

        makenoidxglossaries

        newglossaryentry{thetab}
        {%
        name={$Theta_{b}$},
        description={temperature coefficient for b},
        sort=temperaturecoefficientforb,
        }

        newglossaryentry{thetaa}
        {%
        name={$Theta_{a}$},
        description={temperature coefficient for a},
        sort=temperaturecoefficientfora,
        }

        newglossaryentry{thetade}
        {%
        name={$Theta_{de}$},
        description={temperature coefficient for de},
        sort=temperaturecoefficientforde,
        }

        newglossaryentry{thetaOP}
        {%
        name={$Theta_{OP}$},
        description={temperature coefficient for OP},
        sort=temperaturecoefficientforop,
        }

        begin{document}

        printnoidxglossary[sort=standard,title={List of Symbols}]

        chapter{first chapter}
        lipsum

        testing gls{thetab} and gls{thetaa}

        some more references gls{thetade} and gls{thetaOP}

        end{document}


        enter image description here






        share|improve this answer













        Remove the spaces in the sort key values:



        documentclass{report}
        usepackage{lipsum}
        usepackage{hyperref}
        usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}

        makenoidxglossaries

        newglossaryentry{thetab}
        {%
        name={$Theta_{b}$},
        description={temperature coefficient for b},
        sort=temperaturecoefficientforb,
        }

        newglossaryentry{thetaa}
        {%
        name={$Theta_{a}$},
        description={temperature coefficient for a},
        sort=temperaturecoefficientfora,
        }

        newglossaryentry{thetade}
        {%
        name={$Theta_{de}$},
        description={temperature coefficient for de},
        sort=temperaturecoefficientforde,
        }

        newglossaryentry{thetaOP}
        {%
        name={$Theta_{OP}$},
        description={temperature coefficient for OP},
        sort=temperaturecoefficientforop,
        }

        begin{document}

        printnoidxglossary[sort=standard,title={List of Symbols}]

        chapter{first chapter}
        lipsum

        testing gls{thetab} and gls{thetaa}

        some more references gls{thetade} and gls{thetaOP}

        end{document}


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 13 '16 at 15:48









        Ulrike FischerUlrike Fischer

        192k8302683




        192k8302683






























            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%2f304092%2fglossaries-use-of-sort-key%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

            mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?