-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Enforce print_citations()
in notebooks
#1330
Comments
I agree. I would also suggest then to print citations in a more friendly format (probably a LaTeX format won't be possible) but at least some sort of plain text reference list. This links to issue #1182. |
pybtex seems to work ok now e.g. import pybamm
import pybtex
model = pybamm.lithium_ion.SPM()
sim = pybamm.Simulation(model)
sim.solve([0, 3600])
pybamm.print_citations(filename="test.bib")
print(pybtex.format_from_file("test.bib", "unsrt", output_backend="plaintext")) you can output to markdown too and pick different styles |
That is really cool! Is there a way of doing it without generating a bibtex file every time? |
You can point to a particular file and then pick some keys to cite print(pybtex.format_from_file("test.bib", "unsrt", citations=["sulzer2020python", "harris2020array"], output_backend="plaintext")) In theory we should just be able to point to our CITATIONS.txt and pass the relevant keys, but I was getting an error when I tried to do this. I think it is a bit picky about how things are typed out/formatted in the bib file... |
Yeah, e.g doing print(pybtex.format_from_file("pybamm/CITATIONS.txt", "unsrt", citations=["sulzer2020python", "harris2020array"], output_backend="plaintext")) works, but if you don't pass the citations argument (so that it print all citations) it fails. Think it will be a boring job of fixing commas etc, but then in future we can test to make sure it prints ok so that you just fix a single entry. |
Sounds good! It seems that in order to print all the citations you need to pass |
All notebooks should have the cell
pybamm.print_citations()
at the end, to encourage people to use this command.This can be enforced using regex when running the example tests.
The text was updated successfully, but these errors were encountered: