When using the glossaries
package in a LaTeX document I occasionally want to use a glossary entry as part of section or chapter title. For example:
\section{\Glsentrytext{big}}
This however results in an error. Trying to use \protect\Glsentrytext{}
does not solve the the problem. Note that using the non-capitalized version (\glsentrytext
) does not produce any problems.
Does anyone know of a way to get this to work?
I use the glossaries package occasionally as way to format specific strings in a consistent way. For example \gls{big}
turns into 'beam-into-gas'. Obviously I could create two glossary entries, with and without caps, to achieve this and only include one in the final glossary. That is an ugly solution though.
Unfortunately I don't know why this doesn't work or how to fix it but I know a workaround:
Note: This requires a current version of the glossaries
package. I tested it with version 2.07 which worked and with version 2.03 which didn't work because the user1-user6 keys didn't exist in that version.
Define the entry with the following command:
\newglossaryentry{big}{name=big,type=main,text={beam-into-gas},user1={Beam-into-gas}}
And then use it like that:
\section{\glsentryuseri{big}}
If the section title is the only occurrence of the entry then you have to add the entry to the glossary manually using \glsadd{big}
.
This workaround is similar to the idea you posted about creating two entries except that you don't have to create two entries. :-)
However, I could imagine that the fact that \Glsentrytext
doesn't work is a limitation in LaTeX which would mean that it can't be done. But this is just guessing though.
PS: Maybe you should have posted the question on http://tex.stackexchange.com to get an answer faster.