I'm trying to get a glossarystyle working with tabularx but run into some issues. I have seen people claiming both they have been able to make it work and others saying glossaries will never work with tabularx (I haven't seen an explanation as to why).
I've put together a MWE showing the issue:
\documentclass[10pt, a4paper]{article}
\usepackage{tabularx}
\usepackage{hyperref}
\usepackage{glossaries}
\makeglossaries
\newglossarystyle{glostable}
{%
\renewenvironment{theglossary}%
{\begin{tabularx}{\linewidth}{ll}}%
{\end{tabularx}}%
\renewcommand*{\glossaryheader}{}%
\renewcommand*{\glsgroupheading}[1]{}%
\renewcommand*{\glsgroupskip}{}%
\renewcommand{\glossentry}[2]{%
\glossentryname{##1} & \glossentrydesc{##1} \\%
}%
\renewcommand*{\subglossentry}[3]{}%
}
\setglossarystyle{glostable}
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited for scientific documents}
}
\longnewglossaryentry{HTML}
{
name={Hypertext Markup Language (HTML)},
description={Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScript.},
first={Hypertext Markup Language (HTML)},
text={HTML}
}
\begin{document}
When I try to compile this document (assume makeglossaries has run successfully), I see the following error in the log
[...]
Runaway argument?
\glossarypostamble
! File ended while scanning use of \TX@get@body.
<inserted text>
\par
l.45 \printglossaries
?
! Emergency stop.
[...]
I have tried with longtable instead, but I can't get it to look as nice as the other tables, especially the columns with long texts.
Some notes:
- I know the
ll
columns don't make much sense in the MWE, but I tried to keep it as simple as possible here - I want to usetabularx because:
- that is what I use in the rest of the document
- I have items with long descriptions and tabularx gives me nice controls over columns
- I use it in combination with ltablex for repeating headers