jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

Error message when using footcite from sphinxcontrib-bibtex in a markdown file (but not in rst file)

Open ghost opened this issue 4 years ago • 6 comments

Describe the bug

Hi there! I want to use the footcite directive of sphinxcontrib-bibtex. However, when I use this directive in a markdown file (ending .md , and as {footcite}) jupyter-book throws an error:

/Users/robert/git/jupyterbookdemo/book/markdown.md:: WARNING: No footnote definitions found for label: 'holdgraf_evidence_2014' [myst.footnote]

When I use the same directive in a RST file (ending .rst, and as :footcite:), no such error occurs.

To Reproduce

I attach a zip file of a minimal example, including a build log in the file build.log:

zippedbook.zip

Expected behavior

no such error message

Environment

  • Python Version [e.g. 3.7.1]: 2.7.16
  • Package versions or output of jupyter-book --version: 0.10.2
  • Operating System: macOS 10.15.7

Additional context

none.

ghost avatar May 20 '21 08:05 ghost

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] avatar May 20 '21 08:05 welcome[bot]

I'm running into the same issue - would love to know whether there are any workarounds!

hildeweerts avatar May 03 '22 12:05 hildeweerts

@AakashGfude I know you've recently been looking at footnotes and bibtex citations. When you get a chance could you take a look at this issue?

mmcky avatar May 04 '22 00:05 mmcky

hi @hildeweerts , our workaround is to filter the build log afterwards... Far from optimal, but here is the code:

https://github.com/FAIRplus/the-fair-cookbook/blob/c3a544400345ff48e301c505ff387fb4171f03ef/scripts/extract-warnings.sh

cat _build/cleaned_build.log | grep "WARNING" | grep -vE "\.md:: WARNING: No footnote definitions found for label: '(.*)' \[myst\.footnote\]" | grep -vE "WARNING: image file not readable: (.*)\.mmd\.png" | grep -v "/content/recipes/help/myst.md:" | grep -v "/content/recipes/help/myst.md.rst:" | grep "WARNING" test $? -eq 1 ## grep gives exit code 1 if no line found (== no errors)

ghost avatar May 04 '22 12:05 ghost

Hi @robertgiessmann, thanks for the tip!

I'm still in the early stages of writing content, so think I will just move to .rst files to avoid the issue...

hildeweerts avatar May 04 '22 12:05 hildeweerts

Two bad things (1 Error and 1 warning) appear by myst.footnote specifically in markdown (.md) files and in markdown cells in .ipynb files when you use footbibliography.

  1. Warning: WARNING: No footnote definitions found for label: '' [myst.footnote]

To solve this warning, you just need to suppress this warning by adding the following code to your conf.py file:

suppress_warnings = [ ... "myst.footnote", ] `

  1. ERROR: Document may not end with a transition.

This is also another issue when you add the directive footbibliography to a notebook. Removing/adding a header or some text before or after this directive did not solve the issue for me. So I had to myst_footnote_transition = False. More about this issue here: Obscure warning when heading directly preceded by footnotes.

zakgrin avatar Dec 13 '23 10:12 zakgrin