1

I Have a question about the space after any glos-entry within the text and how to get rid of it. I asked a similar question here. Thats why i am using \glsnoexpandfields. Simply I just dont understand, where the extra spacing after \gls{abc} is coming from. Hopefully someone is able to help. I got the original \newcommand from an instruction on how to write a thesis of my university page 18, there is no spacing.

\documentclass{scrreprt}

\usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} 
\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% }

                % upright indices-shortcut 
\mathcode`\.="8000 
\begingroup\lccode`~=`. 
\lowercase{\endgroup\def~}#1{\mathrm{#1}}

\usepackage{hyperref}

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

        %%% new glossary style 
    \newglossarystyle{symblongtabu}{
            \renewenvironment{theglossary}{
                \begin{longtabu}spread 0pt[l]{ccc<{\strut}l}
                }{
            \end{longtabu}}
            \renewcommand*{\glsgroupheading}[1]{}
            \renewcommand*{\glsgroupskip}{}
            \renewcommand*{\glossaryheader}{
                \toprule
                \bfseries Formelzeichen & \bfseries Bezeichnung &
                \bfseries Einheit & \bfseries Seite(n)
                \tabularnewline\midrule\endhead
                \bottomrule\endfoot}
            \renewcommand*{\glossentry}[2]{
                \glsentryitem{##1}
                % Entry number if required
                \glstarget{##1}{\glossentrysymbol{##1}} &
                \glossentryname{##1} &
                \glsentryuseri{##1} &
                ##2\tabularnewline}}

        \makenoidxglossaries

        %%% newsymb macro
     \newcommand*{\nsymbol}[4]{\newglossaryentry{#1}{
                type=symbols,
                name={#2},
                description={\nopostdesc},
                symbol={{#3}}, 
                user1={#4}, 
                sort={#1}}} 
    \defglsentryfmt[symbols]{\ifmmode
            \glssymbol{\glslabel}
            \else
            \glsgenentryfmt~\glsentrysymbol{\glslabel}
            \fi} 

           %%% entries 
\nsymbol{abc}{alphabet}{$A_.{bc}$}{$\si{cm}$} 
\nsymbol{abc1}{alphabet1}{$A_.{bc1}$}{$\si{\protect\metre}$}

        \begin{document}

            \printnoidxglossary[type = symbols, style = symblongtabu]

            \gls{abc} \\
            \gls{abc1}

        \end{document}
1

TeX treats the newline character as a space, so you have a lot of spurious spaces introduced by newlines in your code. You need to comment them out with %.

In the style definition:

    \newglossarystyle{symblongtabu}{% <- comment eol
        \renewenvironment{theglossary}{% <- comment eol
            \begin{longtabu}spread 0pt[l]{ccc<{\strut}l}
            }{% <- comment eol
        \end{longtabu}}% <- comment eol
        \renewcommand*{\glsgroupheading}[1]{}% <- comment eol
        \renewcommand*{\glsgroupskip}{}% <- comment eol
        \renewcommand*{\glossaryheader}{% <- comment eol
            \toprule
            \bfseries Formelzeichen & \bfseries Bezeichnung &
            \bfseries Einheit & \bfseries Seite(n)
            \tabularnewline\midrule\endhead
            \bottomrule\endfoot}% <- comment eol
        \renewcommand*{\glossentry}[2]{% <- comment eol
            \glsentryitem{##1}% <- comment eol
            % Entry number if required
            \glstarget{##1}{\glossentrysymbol{##1}} &
            \glossentryname{##1} &
            \glsentryuseri{##1} &
            ##2\tabularnewline}}

and in the format definition:

\defglsentryfmt[symbols]{\ifmmode
        \glssymbol{\glslabel}% <- comment eol
        \else
        \glsgenentryfmt~\glsentrysymbol{\glslabel}% <- comment eol
        \fi}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.