Usind rst2latex, which command allows me to include a citation key, that references a bibtex database? In latex I would have achieved this with \cite{Rumpelstielzchen2003}
The solution I found is inlineing latex into the rst document:
.. 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}
The role definition at the beginning of the text allows us to put pure latex
inline. With :raw-tex:\cite{Kutschinski2003}
we index a latex reference
from the bibtex file. At the end of the document we put a raw latex paragraph, started with
.. raw: latex that references the library.bib file. (as created by bibtex or mendeley)
The rst file can be compiled with:
rst2latex paper.rst > build/paper.tex && cd build/ && latex paper.tex && bibtex paper.aux && latex paper.tex && pdflatex paper.tex && evince paper.pdf & cd ..
Or create a paper.sh file with following compilation command:
rst2latex paper.rst > build/paper.tex
cd build/
latex paper.tex
bibtex paper.aux
latex paper.tex
pdflatex paper.tex
evince paper.pdf
cd ..
(if latex causes trouble with pictures substitute it with pdflatex)
Another way (though also LaTeX specific) is to make it nicer in editing.
.. role:: cite
.. raw:: latex
\providecommand*\DUrolecite[1]{\cite{#1}}
This way you can use
:cite:`key`
And also at the end of your document:
.. raw:: latex
\bibliographystyle{plain}
\bibliography{/home/path/library}
There is a very handy tool called bib2reSTcitation to convert bibtex style references file to reStructuredText Markup style citation style.
just run:
$ python bib2reSTcitation.py -i tex.bib -o references.txt
And you get what you want. Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With