Acronyms in captions - LaTeX export error #12

Closed
opened 2023-02-25 10:46:55 +00:00 by jdm204 · 4 comments
jdm204 commented 2023-02-25 10:46:55 +00:00 (Migrated from github.com)

Hi, great package, thanks.

When I export to LaTeX with an acronym in a caption (for a figure), I get this error from lualatex:

! Argument of \Hy@tempa has an extra }.

When I look at the .tex the caption looks like this:

\caption{Testing \hyperlink{gls-5}{\label{gls-5-use-3}WWW}.}

After playing around for a bit, I found adding a \protect like so:

\caption{Testing \protect\hyperlink{gls-5}{\label{gls-5-use-3}WWW}.}

fixes the problem for reasons unknown to me.

Is this issue related to this package or org export in general? I'm trying to dig into it but I don't have much experience.

Hi, great package, thanks. When I export to LaTeX with an acronym in a caption (for a figure), I get this error from lualatex: ``` ! Argument of \Hy@tempa has an extra }. ``` When I look at the `.tex` the caption looks like this: ``` \caption{Testing \hyperlink{gls-5}{\label{gls-5-use-3}WWW}.} ``` After playing around for a bit, I found adding a `\protect` like so: ``` \caption{Testing \protect\hyperlink{gls-5}{\label{gls-5-use-3}WWW}.} ``` fixes the problem for reasons unknown to me. Is this issue related to this package or org export in general? I'm trying to dig into it but I don't have much experience.
jdm204 commented 2023-02-25 11:11:25 +00:00 (Migrated from github.com)

I found that I can just put this in my init

(org-glossary-set-export-spec 'latex t
      :use "\\protect\\hyperlink{gls-%K}{\\label{gls-%K-use-%r}%t}")

to avoid the problem---I'm unsure if this will cause other problems later but it's working for now.

I found that I can just put this in my init ``` (org-glossary-set-export-spec 'latex t :use "\\protect\\hyperlink{gls-%K}{\\label{gls-%K-use-%r}%t}") ``` to avoid the problem---I'm unsure if this will cause other problems later but it's working for now.
tecosaur commented 2023-02-26 16:52:27 +00:00 (Migrated from github.com)

Thanks for the report with fix. It looks like \protect is a fairly safe
addition, so I'm inclined to make this change in the default value.

Thanks for the report with fix. It looks like `\protect` is a fairly safe addition, so I'm inclined to make this change in the default value.
jdm204 commented 2023-02-26 17:58:05 +00:00 (Migrated from github.com)

Great, FWIW I've now exported several documents with the \protect setting and I haven't seen any unwanted side effects!

Great, FWIW I've now exported several documents with the `\protect` setting and I haven't seen any unwanted side effects!
tecosaur commented 2023-02-27 16:48:53 +00:00 (Migrated from github.com)

I've just pushed d8071ef6ed, which applies this change.

Thanks for letting me know about this :)

I've just pushed d8071ef6ed95d31d69b069c0300f5cd40df198b9, which applies this change. Thanks for letting me know about this :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: tec/org-glossary#12
No description provided.