Document Classesgb4e, acronym and $maths$

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
pandammonium
Posts: 55
Joined: Thu Oct 30, 2008 4:12 pm

gb4e, acronym and $maths$

Post by pandammonium »

Hi,

I have this code:

Code: Select all

\documentclass{book}
\usepackage[english]{babel}
\usepackage{gb4e}                         % Glosses and examples
\usepackage{acronym}                      % Provides acronym support (it's actually abbreviations in general).
\begin{document}
\begin{acronym}[widthofabbrev]
   \acro{E}{point of the event}
\end{acronym}
\ac{E}
\end{document}
which produces this error:
MiKTeX 2.7 wrote:! Argument of ^ has an extra }.
<inserted text>
\par
l.14 \ac{E}
I see from threads such as this one that gb4e can be problematic, so following the advice there, I use it after the acronym package instead of before, and all is well...until I add an acronym with maths in it:

Code: Select all

\documentclass{book}
\usepackage[english]{babel}
\usepackage{acronym}                      % Provides acronym support (it's actually abbreviations in general).
\usepackage{gb4e}                         % Glosses and examples
\begin{document}
\begin{acronym}[widthofabbrev]
   \acro{E0}[\texorpdfstring{$\mathsf{E}_{0}$}{E0}]{speech act}
\end{acronym}
\ac{E0}
\end{document}
because I get this error:
MiKTeX 2.7 wrote:! Argument of ^ has an extra }.
<inserted text>
\par
l.15 \ac{E0}
I know that using \texorpdfstring in acronyms is ok because I use them in other acronym declarations.
I know that using maths in a texorpdfstring command is ok because Wikibooks says I can do it.
I also know that using maths in acronyms is ok, because the documentation for acronym gives this example: \acro{H2O}[$\mathrm{H_2O}$]{water}.
Also, if I comment out gb4e, there's no problems with the maths or /texorpdfstring.
I also tried using \ensuremath instead of the $s, but I still got errors.
So the problem is clearly gb4e. The date of my version is 2001-05-14.

Anyone know what's going on and how to fix or workaround it? Changing to another package for abbreviations is a last resort because I like this one and I've used it a lot so far in this work. Any ideas and time spent on this is much appreciated.

Cheers,

Pandammonium

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Re: gb4e, acronym and $maths$

Post by phi »

As you already pointed out, the problem here is the gb4e package. I've just taken a look at the package's source code, and I think that the code is quite ugly. The package defines many short commands without checking if they already exist, it changes category codes, and it uses internal LaTeX commands. Each of these points prevents the package from "playing well with others" (PWWO). The gb4e package is so horrible that it would need a complete rewrite to be fixed. I strongly advise not to use this package. Try everything you can to get its functionality from elsewhere.
pandammonium
Posts: 55
Joined: Thu Oct 30, 2008 4:12 pm

Re: gb4e, acronym and $maths$

Post by pandammonium »

Thanks for taking the time to do that, phi. Unfortunately, this package, when it works, is the best there is. Other similar packages, such as covington, don't provide as good functionality. Ho hum.
Post Reply