我有一个包含许多引文的参考书目文件,以及引用这些内容的各种 jupyter 笔记本。以前这些是使用 jupyter book 处理的,但我现在需要创建原始笔记本版本。
考虑到这一点,我尝试了这个
创建一个简单的参考书目bib.bib
@article{smid_development_2021,
title = {Development of the {Advanced} {Encryption} {Standard}},
volume = {126},
url = {https://www.nist.gov/publications/development-advanced-encryption-standard},
abstract = {Strong cryptographic algorithms are essential for the protection of stored and transmitted data throughout the world.},
language = {en},
urldate = {2023-05-17},
journal = {NIST},
author = {Smid, Miles E. and Foti, James},
month = aug,
year = {2021},
note = {Last Modified: 2021-10-14T05:10-04:00
Publisher: Miles E. Smid, James Foti},
file = {Full Text PDF:/Users/dasc/Zotero/storage/5YCK8JKG/Smid and Foti - 2021 - Development of the Advanced Encryption Standard.pdf:application/pdf},
}
现在在 lesson1.ipynb 中创建一个简单的笔记本,其中包含 AES[@smid_development_2021] 形式的单个引用或完整:
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "364e8ef9-eebe-4da8-b3e2-0005c94392ae",
"metadata": {},
"outputs": [],
"source": [
"# Test document for pandoc\n",
"\n",
"We have just one article on the development of AES[@smid_development_2021]\n",
"\n",
"# References\n",
"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
我也想要 IEEE 格式的引文,所以下载
https://github.com/itation-style-language/styles/blob/master/ieee.csl为ieee.csl
然后我调用
pandoc -f ipynb -t ipynb --citeproc lesson1.ipynb -o lesson1-withrefs.ipynb --bibliography bib.bib --csl ieee.csl
但是除了细微的元数据差异之外,输出实际上与输入相同
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Test document for pandoc\n",
"\n",
"We have just one article on the development of AES[@smid_development_2021]\n",
"\n",
"# References\n",
"\n"
],
"id": "364e8ef9-eebe-4da8-b3e2-0005c94392ae"
}
],
"nbformat": 4,
"nbformat_minor": 5,
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3 (ipykernel)",
"language": "python"
},
"language_info": {
"name": "python",
"codemirror_mode": {
"name": "ipython",
"version": "3"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
}
}
然后我尝试了其他变体,例如写入 html 或 markdown (gfm),但无法扩展引用。
我能够在另一个测试中使用
的降价输入文件完全处理参考书目参考文献---
# Reference
bibliography: references.bib
link-citations: true
csl: ieee.csl
nocite: "@*"
---
以及适当的调用更改
所以我想我犯了一个非常简单/愚蠢的错误,但我还没有弄清楚哪里。 pandoc 对我来说是新的,我也不熟悉它编写 .ipynb 的功能
有人能发现明显的错误吗?
非常感谢
我不认为 Pandoc 的 Jupyter Notebook writer 支持你想要的。以 Markdown 到 Markdown 为例,如果输入是
We have just one article on the development of AES[@smid_development_2021]
pandoc -f markdown -t markdown --citeproc --bibliography bib.bib mwe.md
的输出是
We have just one article on the development of
AES[@smid_development_2021]
我的理解是 Pandoc 主要将参考书目转换为 HTML 和 LaTeX。