rchaput / acronyms

Adds support for Acronyms, and List of Acronyms, to Quarto documents.
GNU General Public License v3.0
19 stars 2 forks source link

LoA with the new shortcode style #27

Open agdamsbo opened 2 months ago

agdamsbo commented 2 months ago

Hi So, I have run into an issue. I wanted to migrate to the new shortcode style {{< acr KEY >}}. When doing so, the LoA is empty (using the option include_unused: false). Mixing new and old style shortcode, \acr{KEY} is included in the LoA.

agdamsbo commented 2 months ago

And here is the example to replicate:

---
title: Alphabetical glossary
format: html
editor: source
filters:
  - acronyms
acronyms:
  sorting: "alphabetical"
  include_unused: false
  keys:
    - shortname: Qt
      longname: Quarto
    - shortname: iQt
      longname: inside-Quarto
    - shortname: aA
      longname: alphabetically
    - shortname: H
      longname: handle
---

This \acr{Qt} extension adds the ability to automatically \acr{H} acronyms {{< acr iQt >}}. Would love to be able to sort \acr{aA}, independent of letter size.
agdamsbo commented 2 months ago

Same problem in pdf and html.

rchaput commented 2 months ago

Hi,

Sorry about that, there is a problem with the shortcodes ({{< >}} )syntax, in that we cannot, AFAIK, decide when they will be handled by Quarto. This means that, depending on when Quarto decides to replace the {{< acr iQt >}}, this acronym may or may not be registered as "used" by acronyms when the List of Acronyms is generated.

However, it seems strange that the include_unused: true option does not work for you? This option tells acronyms to include all acronyms defined in the metadata, independently of whether they appear in the document, thus circumventing the problem of shortcodes being processed after the LoA is generated. In your example, include_unused is set to false.

agdamsbo commented 2 months ago

Sorry about that, there is a problem with the shortcodes ({{< >}} )syntax, in that we cannot, AFAIK, decide when they will be handled by Quarto. This means that, depending on when Quarto decides to replace the {{< acr iQt >}}, this acronym may or may not be registered as "used" by acronyms when the List of Acronyms is generated.

Ok. I will revert back to old style and wait for and update from Quarto.

However, it seems strange that the include_unused: true option does not work for you? This option tells acronyms to include all acronyms defined in the metadata, independently of whether they appear in the document, thus circumventing the problem of shortcodes being processed after the LoA is generated. In your example, include_unused is set to false.

Oh. Sorry. That was a mistake. include_unused: true works as expected.

agdamsbo commented 2 months ago

Oh, and from what I can gather from this thread, the Quarto cross-reference overhaul is being pushed: https://github.com/quarto-dev/quarto-cli/issues/1697

rchaput commented 2 months ago

Quarto has confirmed that the order of shortcodes cannot be guaranteed and is unreliable (see here). Unfortunately, until this is solved on their end, there will always be a risk that the list of acronyms does not correctly handle the "used" acronyms...