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 am trying to align my symbols in a glossary with \phantom. However when I try to do so, I get the following error (line 10 is the line where the definition of nc:line:num ends(closing brace)):

! Incomplete \iffalse; all text was ignored after line 10.

near MWE:

\documentclass{report}

\usepackage[sanitize=none]{glossaries}

\makeglossaries%

\newglossaryentry{nc:line:num}{
    name=thing,
    symbol=\ensuremath{\phantom{\#}l},
    description=other thing}
\newglossaryentry{nc}{
    name=thingy,
    symbol=\ensuremath{\#l},
    description=something}


\usepackage{glossary-mcols} 


\begin{document}
    \printglossary[style=altlong4col]
    asd
    \clearpage%
    nc:line:num glossary entry '\gls{nc:line:num}` \gls{nc}
\end{document}

Background: I have symbols that usually exist in two versions as symbol and as #symbol, therefore i would like to align in the following way:

 symbol
#symbol
 other
#other

rather than

symbol
#symbol
other
#other

Note: sanitize=none is used because I reference entries from another glossary, see this awnser

share|improve this question
    
maybe a different phrasing of the title would make this more "attractive", something like "aligning glossary entries with a flag character to the left of some entries". (too many words, but you get the idea.) –  barbara beeton Jun 14 '13 at 15:11
    
@barbarabeeton: thank you for your input. Luckily I already have the awnser and unfortunately I fail to see a catchy phrase, but I will try to keep this in midn for new questions. –  ted Jun 16 '13 at 13:20
add comment

1 Answer 1

up vote 2 down vote accepted

The entry for symbol is written to the file .glo. \phantom or \hphantom is fragile and breaks. \protect needs to be used:

\documentclass{report}

\usepackage[sanitize=none]{glossaries}

\makeglossaries%

\newglossaryentry{nc:line:num}{
    name=thing,
    symbol=\ensuremath{\protect\hphantom{\#}l},
    description=other thing}
\newglossaryentry{nc}{
    name=thingy,
    symbol=\ensuremath{\#l},
    description=something}  


\usepackage{glossary-mcols}


\begin{document}
    \printglossary[style=altlong4col]
    asd
    \clearpage%
    nc:line:num glossary entry '\gls{nc:line:num}` \gls{nc}
\end{document}

Result

share|improve this answer
    
for those who are as unfamiliar with latex as i am, looke here to see what protect and fragile are about –  ted Jun 16 '13 at 12:50
add comment

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.