Hi Steven, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: [] >> In [43]: print pypandoc.convert(s, 'latex', format='rst') >> this is \textbackslash{}some restructured text. >> >> since a literal backslash gets converted to a literal latex backslash. > > Why is this a problem? Isn't the ultimate aim to pass it through latex, > which will then covert the \textbackslash{} back into a backslash? If not, > I have misunderstood something.
\textbackslash{} is a latex command to typeset a backslash into the text. This is not what I need. I need to have a string of the form "\some" (actually we are talking about \ref or \hyperref commands). > If not, you could do something like this: > > s = 'this is %(b)ssome restructured text.' > t = pypandoc.convert(s, 'latex', format='rst') > assert t == 'this is %(b)ssome restructured text.' > print t % {'b': '\\'} This is somehow what I'm doing now, but is very dirty and difficult to expand to other corner cases. Al -- https://mail.python.org/mailman/listinfo/python-list