Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #86716

Re: rst and pypandoc

From Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de>
Subject Re: rst and pypandoc
Date 2015-03-02 12:03 +0100
References <cliji5FvctU1@mid.individual.net>
Newsgroups comp.lang.python
Message-ID <mailman.24.1425294257.13471.python-list@python.org> (permalink)

Show all headers | View raw


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 ?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

rst and pypandoc al.basili@gmail.com (alb) - 2015-03-02 07:59 +0000
  Re: rst and pypandoc Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2015-03-02 12:03 +0100
  Re: rst and pypandoc Dave Angel <davea@davea.name> - 2015-03-02 07:03 -0500
    Re: rst and pypandoc al.basili@gmail.com (alb) - 2015-03-02 12:36 +0000
  Re: rst and pypandoc Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-02 23:33 +1100
    Re: rst and pypandoc al.basili@gmail.com (alb) - 2015-03-02 13:51 +0000
      Re: rst and pypandoc Dave Angel <davea@davea.name> - 2015-03-02 09:08 -0500
        Re: rst and pypandoc Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-03 01:43 +1100
          Re: rst and pypandoc Dave Angel <davea@davea.name> - 2015-03-02 13:55 -0500
          Re: rst and pypandoc Ben Finney <ben+python@benfinney.id.au> - 2015-03-03 06:09 +1100
          Re: rst and pypandoc Dave Angel <davea@davea.name> - 2015-03-02 14:16 -0500
        Re: rst and pypandoc al.basili@gmail.com (alb) - 2015-03-02 22:30 +0000
          Re: rst and pypandoc Chris Angelico <rosuav@gmail.com> - 2015-03-03 09:51 +1100
          Re: rst and pypandoc Ben Finney <ben+python@benfinney.id.au> - 2015-03-03 10:18 +1100
          Re: rst and pypandoc Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-03 10:32 +1100
            Re: rst and pypandoc al.basili@gmail.com (alb) - 2015-03-03 20:35 +0000
        Re: rst and pypandoc al.basili@gmail.com (alb) - 2015-03-02 22:40 +0000
          Re: rst and pypandoc Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-02 23:08 +0000
            Re: rst and pypandoc al.basili@gmail.com (alb) - 2015-03-03 20:37 +0000
          Re: rst and pypandoc Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-03 10:22 +1100
            Re: rst and pypandoc al.basili@gmail.com (alb) - 2015-03-03 20:46 +0000
          Re: rst and pypandoc Dave Angel <davea@davea.name> - 2015-03-02 18:23 -0500
      Re: rst and pypandoc MRAB <python@mrabarnett.plus.com> - 2015-03-02 14:37 +0000
        Re: rst and pypandoc al.basili@gmail.com (alb) - 2015-03-02 22:37 +0000
          Re: rst and pypandoc Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-03-03 19:40 +1300
            Re: rst and pypandoc al.basili@gmail.com (alb) - 2015-03-03 20:50 +0000
              Re: rst and pypandoc Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-03-04 11:27 +1300
      Re: rst and pypandoc MRAB <python@mrabarnett.plus.com> - 2015-03-02 14:40 +0000
      Re: rst and pypandoc Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-03 02:09 +1100

csiph-web