Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a problem with using the glossary package. I use sharelatex.

When I use a glossary term (first and others), there appears an unwanted space in the output document.

This is the code I use:

Main

\usepackage[acronym, translate=babel, nopostdot]{glossaries}
\makeglossaries

% External files
\loadglsentries{Z_glossary}
\loadglsentries{Z_afkortingen}

% Not in table of contents
\glstocfalse

% First appearance in italic
\defglsdisplayfirst[\glsdefaulttype]{\textit{#1}}

The Glossary

\newglossaryentry{workflowpattern}%
{%
    name={Workflowpattern}, 
    description={Blablabla}, 
    text={workflowpattern}, 
    plural={workflowpatterns}, 
    first={workflowpattern},            
    firstplural={workflowpatterns},
}

The text

zijn de \glspl{workflowpattern} en beschrijven

And the result:

The output

share|improve this question

2 Answers 2

up vote 3 down vote accepted

The unwanted space comes from \defglsdisplayfirst of glossaries.sty 2014/01/20 v4.03, see the line marked with % <==:

\newcommand*{\defglsdisplayfirst}[2][\glsdefaulttype]{%
  \GlossariesWarning{\string\defglsdisplayfirst\space is now obsolete.^^J
  Use \string\defglsentryfmt\space instead}%
  \expandafter\def\csname gls@#1@displayfirst\endcsname##1##2##3##4{#2}%
  \edef\@gls@doentrydef{%
    \noexpand\defglsentryfmt[#1]{%
      \noexpand\ifcsdef{gls@#1@display}%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\csuse{gls@#1@displayfirst}}
          {\noexpand\csuse{gls@#1@display}}%
      }%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\csuse{gls@#1@displayfirst}}%
          {\noexpand\glsdisplay} % <==
      }%
    }%  
  }%
  \@gls@doentrydef
}

As workaround, the definition without the unwanted space:

\usepackage[...]{glossaries}
\makeatletter
\renewcommand*{\defglsdisplayfirst}[2][\glsdefaulttype]{%
  \GlossariesWarning{\string\defglsdisplayfirst\space is now obsolete.^^J
  Use \string\defglsentryfmt\space instead}%
  \expandafter\def\csname gls@#1@displayfirst\endcsname##1##2##3##4{#2}%
  \edef\@gls@doentrydef{%
    \noexpand\defglsentryfmt[#1]{%
      \noexpand\ifcsdef{gls@#1@display}%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\csuse{gls@#1@displayfirst}}
          {\noexpand\csuse{gls@#1@display}}%
      }%
      {%
        \noexpand\@@gls@default@entryfmt
          {\noexpand\csuse{gls@#1@displayfirst}}%
          {\noexpand\glsdisplay}% without unwanted space
      }%
    }%  
  }%
  \@gls@doentrydef
}
\makeatother
share|improve this answer
    
Thanks Heiko. This will be fixed in version 4.04. –  Nicola Talbot Mar 3 at 9:19
    
Thank you. I had to place it before \defglsdisplayfirst[\glsdefaulttype]{\textit{#1}} –  TomH Mar 3 at 9:34

use

\defglsdisplayfirst[\glsdefaulttype]{\textit{#1}\ignorespaces}
share|improve this answer
    
Your solution also worked fine. Thank you! –  TomH Mar 3 at 9:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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