# using \lstinline withtin glossaries - sorting problem

I seem to have a sorting problem using glossaries... I am not quite sure what exactly the problem is, but I cant get rid of it

\documentclass{scrreprt}

\usepackage[utf8]{inputenc} \usepackage[ngerman]{babel}

\usepackage{listings}

\usepackage[acronym, symbols, nomain, toc, sanitizesort]{glossaries}

\makenoidxglossaries
\newglossary*{glsentry}{Glossary}
\newglossaryentry{hi}{
type=glsentry,
name={\lstinline|high impedance|},
description={describes a logical signal state which is not to be recognized as \lstinline|high| or \lstinline|low|}}
\newglossaryentry{an}{
type=glsentry,
name={another},
description={another entry}}

\begin{document}
\printnoidxglossary[type = glsentry]
\section{test}
\gls{hi} \\
\gls{an}
\end{document}


I could try somethings like sort=def, sort=word etc. but the 'name' auf the entry, does not occur at the right place within the glossary...if I use sort=use or sort=last it is the last entry displayed, but the name does not come up at all...

I am probably doing something wrong and its surely nothing, but I have no more ideas. Thanks in advance.

EDIT: I noticed, that my minimal example is using bold itemlabels within the glossary, but my actual project does not...this is why I added an extra example, with all the related options (as far as I can assume)...but this does contain the bold "high impedance" within the glossary as well, my project does not.

\documentclass{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{listings}
\usepackage[locale=DE]{siunitx}
\sisetup{detect-mode = false,
detect-family=true,
mode=math,
%               output-decimal-marker={,},
binary-units=true,
group-separator={\,},group-minimum-digits=3%
}

\usepackage[acronym, symbols, nomain, toc, sanitizesort, style=index]{glossaries}
\usepackage{booktabs}   % essential for customized symbol glossary
\usepackage{tabu}   % essential for customized symbol glossary
\glsnoexpandfields
% create customized symbols
\newglossarystyle{symblongtabu}{
\renewenvironment{theglossary}{
}{
\end{longtabu}}
\renewcommand*{\glsgroupskip}{}
\toprule
\bfseries Formelzeichen & \bfseries Beschreibung &
\bfseries Einheit & \bfseries Seite(n)
\bottomrule\endfoot}
\renewcommand*{\glossentry}[2]{
\glsentryitem{##1}
% Entry number if required
\glstarget{##1}{\glossentrysymbol{##1}} &
\glossentrydesc{##1} &
\glsentryuseri{##1} &
##2\tabularnewline}}

\makenoidxglossaries

% symbol entries without description
\newcommand*{\nsymbol}[4]{\newglossaryentry{#1}{
type=symbols,
name={#2},
description={\nopostdesc},
symbol={\ensuremath{#3}},
%               user1={#4},
user1={$\si{#4}$},
sort={#1}}}
\newcommand*{\nsymbold}[5]{\newglossaryentry{#1}{
type=symbols,
name={#2},
description={#5},
symbol={\ensuremath{#3}},
%               user1={#4},
user1={$\si{#4}$},
sort={#1}}}
\defglsentryfmt[symbols]{\ifmmode
\glssymbol{\glslabel}
\else
\glsgenentryfmt~\glsentrysymbol{\glslabel}
\fi}

\nsymbold{i}{current}{i_1}{\ampere}{current of line 1}

\newacronym{ac}{AC}{Accounting Current}

\newglossary*{glsentry}{Glossary}
\newglossaryentry{hi}{
type=glsentry, name={\lstinline|high impedance|}, description={describes an signal state which is not to be recognized as \lstinline|high| or \lstinline|low|}}
\newglossaryentry{hi2}{
type=glsentry, name={high impedance}, description=describes an signal state which is not to be recognized as high or low}
\newglossaryentry{an}{
type=glsentry, name={another}, description={another entry}}

\begin{document}

\printnoidxglossary[type = acronym, title = {glos1}]
\printnoidxglossary[type = glsentry, style=index]

\printnoidxglossary[type = symbols, style = symblongtabu, title = {glos2}]

\newpage

\section{test}
\gls{hi}\\
\gls{i}\\
\gls{ac}

\end{document}


Maybe someone got some time to waste and is able to assume what I am using wrong...

• I realize an MWE can leave out stuff, in the name of simplicity, relative to your actual application. but why do you wish to use \lstinline at all. What is it doing for you in this context? – Steven B. Segletes Sep 13 '17 at 15:16
• not quite sure what MWE means, but thanks for the respond. Well I need to explain such things as high impedance or a few programming commands which I would like to display with \lstinline – Pratched Sep 13 '17 at 15:27
• I mean it could be possible to create a command glossary for instants...thats something to use \lstinline for sure (or any other code formatting package – Pratched Sep 13 '17 at 15:36
• You glossary style doesn't use \glossentryname within \glossentry so the name's not going to show. You might be better off posting that as a follow-up question. – Nicola Talbot Sep 13 '17 at 18:06
• well if you are talking about the \newglossaryentrystyle{symblongtabu} that is alright...the symbol glossary is as I want it to be. The 'bold-itemlabel' issue is still with the glossary entry of "high impedance" - As I understand it is using another style than the symbol glossary...but alright PS: It is difficult to explain, because the issue does NOT occur with the given minimal example – Pratched Sep 13 '17 at 18:16

First you need to understand what \printnoidxglossary is trying to do. With the default style=list, it's using the description environment and putting the name inside the optional argument of \item. So test this out:

\documentclass{scrreprt}

\usepackage{listings}

\newcommand{\test}{\lstinline|high impedance|}

\begin{document}
\begin{description}
\item[\test] test.
\end{description}
\end{document}


This produces

The item label is lost, which means the same is going to happen with glossaries if you use this style. (I suspect this may have something to do with \lstinline's verbatim-like qualities.)

The index style is a reasonable approximation, so use style=index:

\documentclass{scrreprt}

\usepackage[utf8]{inputenc} \usepackage[ngerman]{babel}

\usepackage{listings}

\usepackage[acronym, symbols, nomain, toc, sanitizesort,style=index]{glossaries}

\makenoidxglossaries
\newglossary*{glsentry}{Glossary}
\newglossaryentry{hi}{
type=glsentry,
name={\lstinline|high impedance|},
description={describes a logical signal state which is not to be recognized as \lstinline|high| or \lstinline|low|}}
\newglossaryentry{an}{
type=glsentry,
name={another},
description={another entry}}

\begin{document}
\printnoidxglossary[type = glsentry]
\section{test}
\gls{hi} \\
\gls{an}
\end{document}


This produces:

"high impedance" comes before "another" because the sort values are \lstinline|high impedance| and another. The first value starts with \ and the second starts with a. You're using \makenoidxglossaries which performs an ASCII sort and the character code for \ is less than the character code for a. If you want to change this ordering, you need to specify the sort value:

\newglossaryentry{hi}{
type=glsentry,
name={\lstinline|high impedance|},
sort={high impedance},
description={describes a logical signal state which is not to be
recognized as \lstinline|high| or \lstinline|low|}}

• Well thank you very much for this helpfull explanation and solution. I cant extract those kind of information out of the package documentations...but mybe this just takes some experience. However, I still dont understand, why, depending on the sort-option the itemlabel is missing at all (not the description) or is shifted into another 'item', BUT fully formatted. But thats not that important I'd say... – Pratched Sep 13 '17 at 16:26
• @Djiwahwah It's experience :-) I rather regret making the list style the default as it turns out there are so many situations where it can go wrong. (Not to mention the number of classes and packages that alter the description environment.) The index style would've been much better as the default, but I can't change it now. The \makenoidxglossaries method is quite problematic. I recommend \makeglossaries with the automake package option if you can't integrate the external tools. – Nicola Talbot Sep 13 '17 at 16:55
• yeah...I am kinda struggle on how to use those "extra programs" (xindy, cli)...I guess it is not that hard...but for now I stick with option 1 - Ill switch probably for future thesis. Anyway, I noticed that within my minimal example the itemlabel is bold, which it is supposed to do, but within my real project it is not. I will update an minimal example with all the other stuff which might effect glossarie... – Pratched Sep 13 '17 at 17:46