Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'suppose': 0.07; 'escape': 0.09; 'interpreted': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrapper': 0.09; 'python': 0.11; 'backslash': 0.16; 'character.': 0.16; 'characters:': 0.16; 'directive': 0.16; 'docs.': 0.16; 'printing.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'restructured': 0.16; 'wrote:': 0.18; 'everyone,': 0.19; 'figures': 0.19; 'print': 0.22; 'header:User-Agent:1': 0.23; "haven't": 0.24; "i've": 0.25; 'references': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "i'm": 0.30; 'work.': 0.31; "skip:' 10": 0.31; 'received:132': 0.31; 'file': 0.32; 'figure': 0.32; 'text': 0.33; "i'd": 0.34; 'convert': 0.35; 'but': 0.35; 'should': 0.36; 'to:addr:python-list': 0.38; 'issue': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'our': 0.64; 'biggest': 0.67; 'special': 0.74; 'forced': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Wolfgang Maier Subject: Re: rst and pypandoc Date: Mon, 02 Mar 2015 12:03:23 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: px1.ruf.uni-freiburg.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1425294257 news.xs4all.nl 2858 [2001:888:2000:d::a6]:43505 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86716 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 ?