tecosaur / org-glossary

Mirror of https://git.tecosaur.net/tec/org-glossary
GNU General Public License v3.0
96 stars 4 forks source link

Linking to Acronyms is broken if using %K nonce gls-links #25

Open hpgisler opened 2 days ago

hpgisler commented 2 days ago

Hi

I seem to have a problem with Acronyms generation, when exporting my document to latex / pdf.

The links in the text referring to the entries in the Acronyms section are sometimes broken.

Checking the .tex and .log output files reveals, that some of the gls-<nonce> labels the text is referring to do not exist as \label in the Acronyms section. I suspect that this may have to do with the multiple passes required for org /latex / tex generation, i.e. that (later?) generated gls-<nonce> labels overwrite previous ones. I don't know, whether this makes sense?

The resulting effect is that those links with existing \label targets are at the wrong location (mostly Glossary entries are referred to inseatd of acronym entries) and that for a lot of links no label exists at all in the Acronyms section.

I have observed that if I change in org-glossary-export-specs the following from

(latex
  (t :use "\\protect\\hyperlink{gls-%K}{\\label{gls-%K-use-%r}%t}" :definition "\\hypertarget{gls-%K}{%t}"))

to

(latex
  (t :use "\\protect\\hyperlink{gls-%k}{\\label{gls-%k-use-%r}%t}" :definition "\\hypertarget{gls-%k}{%t}"))

i.e. use %k clear text labels instead of %K nounces, then the problem goes away.

tecosaur commented 2 days ago

Thanks for the report! I suspect this may be linked to https://github.com/tecosaur/org-glossary/issues/19#issuecomment-2227319858, which needs further investigation from me (time permitting).