rst and pypandoc

alb al.basili at gmail.com
Mon Mar 2 02:59:03 EST 2015


Hi everyone,

I'm writing a document in restructured text and I'd like to convert it 
to latex for printing. To accomplish this I've used semi-successfully 
pandoc and the wrapper pypandoc.

My biggest issue is with figures and references to them. We've our macro 
to allocate figures so I'm forced to bypass the rst directive /.. 
figure/, moreover I haven't happened to find how you can reference to a 
figure in the rst docs.

For all the above reasons I'm writing snippets of pure latex in my rst 
doc, but I'm having issues with the escape characters:

i = '\ref{fig:abc}'
print pypandoc.convert(i, 'latex', format='rst')
ef\{fig:abc\}

because of the \r that is interpreted by python as special character.

If I try to escape with '\' I don't seem to find a way out...

Any idea/pointer/suggestion?

Al

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?



More information about the Python-list mailing list