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

Add option to not specialcase @article type in href positioning #74

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

lgoettgens
Copy link
Contributor

@lgoettgens lgoettgens commented Sep 17, 2024

Resolves #73 in a straight-up fashion.
Alternatively, one could add some preference for this, or add a dispatch on style::Val{:stylesymbol} for this to make users able to adapt the bibliography printing themselves.

@lgoettgens
Copy link
Contributor Author

After looking at the test failures, I noticed that this does not result in desired formatting for paper that are only available on the arXiv, when one follows the docs

For documents that are available only as an arXiv eprint, the best result is obtained with a BibTeX entry using the @Article class, with, e.g., arXiv:2003.10132 in the Journal field, and, e.g., 10.48550/ARXIV.2003.10132 in the Doi field (but no Eprint field) [11].
Source : https://juliadocs.org/DocumenterCitations.jl/dev/syntax/#Preprint-support

If one however puts the arXiv id in the eprint and removes the "fake journal", as one is supposed to do for entries that have both a doi and an arxiv-id, this looks reasonable. (One currently has to change the article type to misc as well, as article requires a journal attribute to be present, but I think that could be adapted as well.) Overall this needs changes like:

diff --git a/docs/src/refs.bib b/docs/src/refs.bib
index d7e5359..47c4c99 100644
--- a/docs/src/refs.bib
+++ b/docs/src/refs.bib
@@ -682,12 +682,12 @@
     Archiveprefix = {arXiv},
 }
 
-@article{Wilhelm2003.10132,
+@misc{Wilhelm2003.10132,
     Author = {Wilhelm, Frank K. and Kirchhoff, Susanna and Machnes, Shai and Wittler, Nicolas and Sugny, Dominique},
     Title = {An introduction into optimal control for quantum technologies},
-    Journal = {arXiv:2003.10132},
+    eprint = {2003.10132},
+    archiveprefix = {arXiv},
     Year = {2020},
-    Doi = {10.48550/ARXIV.2003.10132},
 }
 
 @article{KochEPJQT2022,
-- 

@goerz
Copy link
Member

goerz commented Sep 17, 2024

I'm not open to changing the current behavior by default, but I'm definitely open to adding some options to make it easier to change in a custom style. See #73 (comment).

Looking at this briefly, it seems like the functions format_published_in and format_labeled_bibliography_reference would both need an additional keyword argument article_link_via_title (default false). I'm open to a better name for the keyword argument. If it is given as true, then the special-casing for article entries would be turned off (if entry.type == "article"if (entry.type == "article") && !article_link_via_title)

That would make it pretty easy to define a custom style with this new behavior, defining a format_bibliography_reference that calls format_labeled_bibliography_reference with article_link_via_title=true.

@lgoettgens
Copy link
Contributor Author

Thanks for your response! I totally understand that you don't want to change the default.
I try to cook something up that makes it possible to configure this later this afternoon and then we can iterate on how exactly it should work.

@lgoettgens lgoettgens changed the title Don't specialcase @article type in href positioning Add option to not specialcase @article type in href positioning Sep 19, 2024
@lgoettgens
Copy link
Contributor Author

I now adapted this to something very similar to your comment #74 (comment).

WIth a very minimal adaption of our doc building in oscar-system/Oscar.jl#4115, @fingolfin and I are very happy with the result.

Please let me know if I should change anything here. For testing this new kwarg, I would need to add a custom style to the test code that uses this kwarg. Is this desireable or rather not?

@goerz
Copy link
Member

goerz commented Sep 19, 2024

For testing this new kwarg, I would need to add a custom style to the test code that uses this kwarg. Is this desireable or rather not?

To simplify testing a little bit, you could follow the examples of the existing tests in test/test_formatting.jl like @testset "format_bibliography_reference(:numeric)" that call format_bibliography_reference, but instead directly call format_labeled_bibliography_reference with the new article_link_doi_in_title=true.

It would definitely be nice to have that kind of test.

@goerz goerz merged commit 1cc8159 into JuliaDocs:master Sep 19, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More consistent formatting of articles and other types
2 participants