【发布时间】:2012-07-14 10:51:01
【问题描述】:
使用 rst2latex,哪个命令允许我包含引用 bibtex 数据库的引用键? 在乳胶中,我会用 \cite{Rumpelstielzchen2003}
实现这一点【问题讨论】:
标签: restructuredtext
使用 rst2latex,哪个命令允许我包含引用 bibtex 数据库的引用键? 在乳胶中,我会用 \cite{Rumpelstielzchen2003}
实现这一点【问题讨论】:
标签: restructuredtext
我找到的解决方案是将乳胶内联到第一个文档中:
.. role:: raw-tex(raw)
:format: latex html
Introduction
============
A profit maximizing agent in an environment with a finite number of buyers
following :raw-tex:`\cite{Kutschinski2003}` investigates price setting by
reinforcement learning agent.
# at the end of the document
.. raw:: latex
\bibliographystyle{plain}
\bibliography{/home/path/library}
文开头的角色定义让我们可以放纯latex
排队。使用 :raw-tex:\cite{Kutschinski2003} 我们索引乳胶参考
来自 bibtex 文件。在文档的末尾,我们放了一个原始的乳胶段落,以
.. raw:引用 library.bib 文件的乳胶。 (由 bibtex 或 mendeley 创建)
第一个文件可以编译:
rst2latex paper.rst > build/paper.tex && cd build/ && latex paper.tex && bibtex paper.aux && latex paper.tex && pdflatex paper.tex && evince paper.pdf & cd ..
或者使用以下编译命令创建一个 paper.sh 文件:
rst2latex paper.rst > build/paper.tex
cd build/
latex paper.tex
bibtex paper.aux
latex paper.tex
pdflatex paper.tex
evince paper.pdf
cd ..
(如果latex导致图片出现问题,请用pdflatex代替)
【讨论】:
另一种方法(虽然也是 LaTeX 特定的)是使它在编辑时更好。
.. role:: cite
.. raw:: latex
\providecommand*\DUrolecite[1]{\cite{#1}}
这样你就可以使用了
:cite:`key`
在您的文档末尾:
.. raw:: latex
\bibliographystyle{plain}
\bibliography{/home/path/library}
【讨论】:
有一个非常方便的工具叫做 bib2reSTcitation 可以将 bibtex 样式引用文件转换为 reStructuredText Markup 样式引用样式。
运行:
$ python bib2reSTcitation.py -i tex.bib -o references.txt
你得到你想要的。希望对您有所帮助!
【讨论】:
A and B and C and D,就像在bibTeX中一样,而且好像没有让你选择引用风格。