rst and pypandoc

Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de
Mon Mar 2 06:03:23 EST 2015


On 03/02/2015 08:59 AM, alb wrote:
> 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...
>

what exactly do you mean by not finding a way out ? Escaping with a '\' 
should work. Of course, that backslash will print for clarity, but I 
suppose you want to write this to a file ? What happens if you do so ?




More information about the Python-list mailing list