Closed yuriever closed 2 years ago
Can you provide more of the error message so I can tell if this is happening while building the internal entry list or if its from something during the conversion to markdown?
Sorry for the late reply. Here is a least mkdocs-material project reproducing the error
The bibtex of the example preprint is
@article{Craig:2022cef,
archiveprefix = {arXiv},
author = {Craig, N. and others},
date-added = {2022-11-13 02:26:19 +0800},
date-modified = {2022-11-13 02:26:19 +0800},
eprint = {2211.05772},
month = {11},
primaryclass = {hep-ph},
reportnumber = {FERMILAB-FN-1212-T},
title = {{Snowmass Theory Frontier Report}},
year = {2022}}
which is copied at the inspirehep page. As you can see that most of preprints on arxiv don't have the journal
entry.
My versions are
Python 3.10.8
mkdocs 1.4.2
mkdocs-bibtex 2.8.5
mkdocs-exclude 1.0.2
mkdocs-material 8.5.9
mkdocs-material-extensions 1.1
The error messages are in error.txt
in mkdocs-bibtex.zip
.
Ah! Ok, you're using the built-in PyBTex based style which is a pretty strict standard built-into PyBTex. I can't modify that. If you want to do any variation off of this I recommend using pandoc mode instead by providing a csl_file
. That will let you choose a style that is accomodating to journal-less entries. The alternative is to add a journal={}
line into the entries that don't have a journal.
Ah! Ok, you're using the built-in PyBTex based style which is a pretty strict standard built-into PyBTex. I can't modify that. If you want to do any variation off of this I recommend using pandoc mode instead by providing a
csl_file
. That will let you choose a style that is accomodating to journal-less entries. The alternative is to add ajournal={}
line into the entries that don't have a journal.
Thx! After adding the csl file everything works.
Just for the future comers.
pandoc
with csl
file may slow down the build comparing with pybtex
.
I modify the apa.csl
file slightly to include the arxiv urls, which can be found here.
If using pybtex
this issue can be quick fixed by modifying the file /lib/python3.10/site-packages/pybtex/style/formatting/unsrt.py
at around line 70.
def get_article_template(self, e):
volume_and_pages = first_of [
# volume and pages, with optional issue number
optional [
join [
field('volume'),
optional['(', field('number'),')'],
':', pages
],
],
# pages only
words ['pages', pages],
]
template = toplevel [
self.format_names('author'),
self.format_title(e, 'title'),
sentence [
#tag('em') [field('journal')],
optional[ field('journal') ],
optional[ volume_and_pages ],
date],
sentence [ optional_field('note') ],
self.format_web_refs(e),
]
return template
This function controls the output of article type entries.
Do you have timings for how much slower it was using pandoc
than pybtex
?
It's also generally not a good idea to modify installed python packages as you might be breaking something else. I doubt thats a huge issue here, but it's just no good practice.
Do you have timings for how much slower it was using
pandoc
thanpybtex
? It's also generally not a good idea to modify installed python packages as you might be breaking something else. I doubt thats a huge issue here, but it's just no good practice.
I have delete pandoc
. In my memory, when mkdocs serve
my site, using pandoc
takes >2s to update changes, while pybtex
almost instantaneously.
Maybe the timing is because I have modified the csl
file in a wrong way. I'm not familiar with that language.
Hi!
When citing preprints such that the bibtex field "journal" is empty, I got errors like
Is there a way to escape empty fields? Thx!