Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\cite: expose optional parameter #183

Closed
pkra opened this issue Nov 29, 2023 · 11 comments
Closed

\cite: expose optional parameter #183

pkra opened this issue Nov 29, 2023 · 11 comments
Assignees
Labels
enhancement/feature New feature or request
Milestone

Comments

@pkra
Copy link
Member

pkra commented Nov 29, 2023

Right now something like

\cite[Lemma 4.1]{Noz08}

is turned into

<x>[</x><xref ref-type="bibr" rid="bibr-Noz08" specific-use="cite">7<x>, </x>Lemma 4.1</xref><x>]</x>

This makes it difficult to specifically process/style the optional part Lemma 4.1 downstream.

Since PDF output separates these (e.g., the optional part is not part of the link), could texml add some kind of structure in its output?

@pkra
Copy link
Member Author

pkra commented Mar 6, 2024

We should also consider moving [, ] inside the xref (or add a wrapper).

@pkra pkra added this to the 2024 milestone Mar 6, 2024
@pkra pkra added the enhancement/feature New feature or request label Mar 6, 2024
@pkra
Copy link
Member Author

pkra commented Apr 25, 2024

To follow up from today's conversation and #198

Going back to the example

<x>[</x><xref ref-type="bibr" rid="bibr-Noz08" specific-use="cite">7<x>, </x>Lemma 4.1</xref><x>]</x>

Since we may have nested xref's in the optional parameter, we need to move the optional parameter outside the xref.

This reminded me of #56 and the "temporary" cite-group element. Perhaps cite is a good candidate? (which we can pass through to HTML)? E.g.,

<cite><x>[</x><xref ref-type="bibr" rid="bibr-Noz08" specific-use="cite">7</xref><x>, </x>Lemma 4.1<x>]</x></cite>

(I don't care too much if the [ ] are inside or outside.)

@davidmjones davidmjones mentioned this issue May 24, 2024
@davidmjones
Copy link
Contributor

@pkra How about this?

<cite-group><x>[</x><xref ref-type="bibr" rid="bibr-AEG0" specific-use="cite">AEG08</xref><x>, </x>Section 5<x>; </x><xref ref-type="bibr" rid="bibr-AEG0" specific-use="cite">AEG08</xref><x>, </x>theorem 4<x>]</x></cite-group>

I'd prefer to stick with <cite-group/> because (a) then it's mostly just a matter of not stripping those and (b) in the general case there can be multiple individual citations grouped together. Neither <cite/> nor <cite-group/> are defined in JATS/BITS of course.

See #201

@davidmjones davidmjones self-assigned this May 24, 2024
@pkra
Copy link
Member Author

pkra commented May 27, 2024

Thanks, David. I like cite-group but the code example above wouldn't (naturally) help with the problem downstream - handling the optional parameter. I tend to prefer the optional parameter to be part of the link (in particular to increase link target size) but I could move it into the link downstream -- I'd just really like a wrapper to identify it.

@davidmjones
Copy link
Contributor

@pkra I'm confused. Above you wrote

<cite><x>[</x><xref ref-type="bibr" rid="bibr-Noz08" specific-use="cite">7</xref><x>, </x>Lemma 4.1<x>]</x></cite>

with the optional text outside of the <xref/> and I thought that was the markup you were proposing. Did you leave out the tags around "Lemma 4.1"? Can you give an example of the markup you'd like to see?

@pkra
Copy link
Member Author

pkra commented May 27, 2024

I was trying 😄

My example was a single citation, your example was multiple ones grouped together.

Let me use your example and combine the two.

With a wrapper on the outside:

<cite-group>
  <x>[</x>
   <cite><xref ref-type="bibr" rid="bibr-AEG0" specific-use="cite">AEG08</xref><x>, </x>Section 5</cite><x>; </x>
   <cite><xref ref-type="bibr" rid="bibr-AEG0" specific-use="cite">AEG08</xref><x>, </x>theorem 4</cite>
<x>]</x>
</cite-group>

With a wrapper on the inside:

<cite-group>
  <x>[</x>
   <xref ref-type="bibr" rid="bibr-AEG0" specific-use="cite">AEG08<cite-detail><x>, </x>Section 5</cite-detail></xref><x>; </x>
   <xref ref-type="bibr" rid="bibr-AEG0" specific-use="cite">AEG08<cite-detail><x>, </x>theorem 4</cite-detail></xref><x>]</x>
</cite-group>

Both have their advantages and drawbacks downstream so I'm not perfectly sure which I'd prefer. I started with the first option in mind but the second one is growing on me.

[EDIT: fixed second example]

@davidmjones
Copy link
Contributor

@pkra Thanks for the clarification. Let me know what you think about the new revision.

@davidmjones
Copy link
Contributor

Implemented following markup:

<cite-group>
    <x>[</x>
    <xref ref-type="bibr" rid="bibr-AEG0" specific-use="cite">AEG08<cite-detail><x>, </x>Section 5</cite-detail></xref>
    <x>; </x>
    <xref ref-type="bibr" rid="bibr-AEG0" specific-use="cite">AEG08</xref>
    <x>]</x>
</cite-group>

@pkra
Copy link
Member Author

pkra commented May 31, 2024

@davidmjones is the following statement correct: xref@specific-use=cite will no longer have x elements as children (instead x will only occur as descendants inside cite-detail)?

@davidmjones
Copy link
Contributor

@davidmjones is the following statement correct: xref@specific-use=cite will no longer have x elements as children (instead x will only occur as descendants inside cite-detail)?

Yes. And I've made a note in the source code that this is the expected behaviour downstream.

@pkra
Copy link
Member Author

pkra commented May 31, 2024

Thanks, David.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement/feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants