openjournals / joss

The Journal of Open Source Software
https://joss.theoj.org
MIT License
1.55k stars 187 forks source link

issue about cross references #1340

Open Freakwill opened 6 months ago

Freakwill commented 6 months ago

I use the following cross-references according to the docs of joss. But why dose it result in ???

A concise comparison ... frameworks provided in \autoref{frameworks}, such as ....

: Comparison ... frameworks. []{label="frameworks"}

The examples provided by the docs are not displayed in a right format also.

sneakers-the-rat commented 6 months ago

taking 10m to help with triage, confirming this with MWE

: Comparison of programming languages. []{label="proglangs"}

| Language | Typing          | Garbage Collected | Evaluation | Created |
|----------|:---------------:|:-----------------:|------------|---------|
| Haskell  | static, strong  | yes               | non-strict | 1990    |
| Lua      | dynamic, strong | yes               | strict     | 1993    |
| C        | static, weak    | no                | strict     | 1972    |

autoref: \autoref{proglangs}
ref: \ref{proglangs}

and building PDF with the docker command

yields

Screenshot 2024-05-21 at 7 35 50 PM

but the latex version works

: Comparison of programming languages. \label{proglangs}

| Language | Typing          | Garbage Collected | Evaluation | Created |
|----------|:---------------:|:-----------------:|------------|---------|
| Haskell  | static, strong  | yes               | non-strict | 1990    |
| Lua      | dynamic, strong | yes               | strict     | 1993    |
| C        | static, weak    | no                | strict     | 1972    |

autoref: \autoref{proglangs}
ref: \ref{proglangs}
Screenshot 2024-05-21 at 7 37 17 PM

the intermediate LaTeX for the caption in the first case is

\caption{Comparison of programming languages. {}}\tabularnewline

and for the second case is

\caption{Comparison of programming languages.
\label{proglangs}}\tabularnewline

so i don't know exactly when the markdown gets latex'd but ya something not working.

I thought that it might have been that we didn't have bracketed_spans enabled, but if i instead just put in an HTML span like <span label="proglangs"></span> that also doesn't work.

If i look at the JATS output, the references are at least correctly created by autoref and ref commands, though proglangs is not added as the table's id property, which is what i see the latex style figure label doing.

  <p>autoref: <xref alt="Table 1" rid="proglangs">Table 1</xref> ref:
  <xref alt="1" rid="proglangs">1</xref></p>

so i think the problem maybe, might be that the lua code for handling references bails if the format is latex? but it also seems like the markdown span isn't being converted into the latex command in the initial pandoc translation stage before the lua filters are applied. https://github.com/openjournals/inara/blob/b259a53005804d260208e8a30c9a09347169ea83/data/filters/resolve-references.lua#L2-L4

with the big caveat that i don't know how to read lua ;)