From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/17898 Path: news.gmane.org!.POSTED!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: How to use LaTeX command "\write18{}" in Pandoc Date: Wed, 12 Jul 2017 13:43:54 +0200 Message-ID: <20170712114354.GA21458@MacBook-Air-2.local> References: <9a1c3693-5d46-4de0-921b-3408ca893bad@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed X-Trace: blaine.gmane.org 1499859851 31443 195.159.176.226 (12 Jul 2017 11:44:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 12 Jul 2017 11:44:11 +0000 (UTC) User-Agent: Mutt/1.5.23 (2014-03-12) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBCMXTDFQKGQED2QYBSY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jul 12 13:44:06 2017 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-oi0-f55.google.com ([209.85.218.55]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVG3o-0007v0-E3 for gtp-pandoc-discuss@m.gmane.org; Wed, 12 Jul 2017 13:44:04 +0200 Original-Received: by mail-oi0-f55.google.com with SMTP id k186sf2004940oib.1 for ; Wed, 12 Jul 2017 04:44:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1499859849; cv=pass; d=google.com; s=arc-20160816; b=HFsPV0mxQEKKDl9bT2cfjzPPT1e/bCgb9X9EeXC3IsWySfpO2me0pTuJeIB8ZR7d+k p14GnxUmbOlBGMhrxkRpWjW5z2KcS45x9z0E0kkDRFlX42C6ebzpedtAQ+R2HHKNUZrC /e5+rnH1jf99ECq7+YnZChXqNPtcxnReBajYiqY97jYO1SDCBQhxsiyFSf0Sw4vEkBQj mUr7+t3jUMSbw2ab0IlrUH83Zvp/F6/rjo9yMRBQ8kTsBeXWIFO1aRCbihPvEdn9C6E5 iMl2TDe6PbId5OsVdiIYerSpmBeS2//f8Bh1wAQUMuSHmpXgUIe1hiV+bBirHnt4ayd2 kOtA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :date:from:arc-authentication-results:arc-message-signature:sender :dkim-signature:arc-authentication-results; bh=NDEPBGsDS/nJkyPfRSlt1Rcsak1Slz9IN2Vg76cnzug=; b=HiLur7t882hEI2+Ho3rU/x/yO5S0msAbMKpnUqTvPVWK27BRIrItLYTtKs63YQKDw7 NabVlzZhWmQwIVoXBjF+Tf962O99gZYYu6/5XP+PtQjQTEpAC5VWKLw5zf8WSU+lCwt8 dufXt4Ua+e9L5PhdhjjXdmkWFntOpvUKLOlxp+r9CvyvjF5SFXPPQlTic3RWkbIStiKm bAa3NelFxMIgLMuEVvBFdiK9BJdHatnaJurM4TcCM+HnsNUxAQ4GsvLuCFLEW+Wp5GAh Iun9AmDsNICuzm0u0bY0SnWXevFIz5KPcRGlxwDpkJCR6F1LjJLPNp2mcRZJdRVgU5G9 ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.b=D+IhY8T8; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::241 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:date:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=NDEPBGsDS/nJkyPfRSlt1Rcsak1Slz9IN2Vg76cnzug=; b=fG3JWOltp0NgR2bsmJ2wYmM4zznQW7xbPam2JP4f8PqfGIDTR3pmMUqN8drFrDswRT +CrcCu+K/sPXPdOQ+r2h3MJkqB9/YqMi7NMVYgYZ6dNZx+qCWm5rsg2F917AzU5BongB X9Ba/1sycT3Wnoui1YsK3ODLICtCQSmJvCpm4QJhgZRf5+ZU/rld82uLJl7Q2ZlcvOda Go/L8rkcaqHsZS4jTWni07SknrPt0l2v8agWYvqRrq0sQi95v9kN9XKzEkE+kTi4nVVY nlILSQ6m8zwCXXszdmY5dPjbVAV2XurJI8vIVCZUzAPmsTbRUEVf0D/KRDZ4ByXfKdaX /fQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:date:to:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=NDEPBGsDS/nJkyPfRSlt1Rcsak1Slz9IN2Vg76cnzug=; b=kR9Z5Rm+DH6mxKxVmM4mvzZ/qj9bRTURRfHEIx8BrA13rUIp1VeW83BcDLBBs/9JtA BQTsOxIaJjbsEPBVbebi52ghFad42OYG8YuYnjoFmxZk9dUeZ9fwB/WlX0WlVK8+zbVM yHcsGjBU8qyelIPUYRavTGx11B6rXUmFmT3OGUfWVeZLawBjADeOlRXqVZduqxgc9t4r qTcuF75vByqbDXSaeuW2Hqync3FmDPA7qRvt+Wj4wmXS18j4hldFWfmD7jshwt9rtoYF EAgFI4lFbVgIdOeePieWQEpz+pQowqEGyWwjEWBwyrFHQRoH/FxV5caY+qTgN0bhlg4K Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AIVw110LOfJveUfk35tuBbDtZWk/x341l6ejAJDmBhu+lKZ07xDx3wET 9t7aY5An/VnsJA== X-Received: by 10.36.34.10 with SMTP id o10mr320301ito.10.1499859849830; Wed, 12 Jul 2017 04:44:09 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.36.40.197 with SMTP id h188ls1156705ith.19.gmail; Wed, 12 Jul 2017 04:44:08 -0700 (PDT) X-Received: by 10.129.93.215 with SMTP id r206mr2902205ywb.143.1499859848917; Wed, 12 Jul 2017 04:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499859848; cv=none; d=google.com; s=arc-20160816; b=xOIrTN5STuZIIjzDu89jkJwecZvUtyV25JUUKtoK+NfyRSQwMcth5BnTiulreeVVMj Gj0kQVCmhGVI3z+PsCUryNSpkXNOKhr2H7Hc5mHD2BkB+7v1MXQo/Ul6HsJxPZAK2Gof CtA4ZvwGSVg/JJxtIzZNexKHk8dRhWB/GhcHG9SFCDYHiuYZw+JdcMblDQhn3judXbpE I2kcqU47aUbPWx4aO/u3aLzocd39kUlavPGMLnX+m8ddI04sYxXqW9KbwpeV9xEu3sov QFNv8dlzJoqsXgSnTXl+/ba6vd+U1Vz3vNubgXsEFe96s/jWaC0v8gwG1c/H3iJiEp7G oHfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:to:date:from:dkim-signature :arc-authentication-results; bh=bZRM8fBnsTiBYBEY1LGNgWkKfWyDehHeD+76IW2s1Lc=; b=Qx5g5rzTJk2sXJQwJfL+peeOTfQD0uTDfc/bFJSSt93U7uYiezp6qxskZsNyzqO9qw 5wtdJyTz7l2Svelfiu0ppVgqdoEZjTHvkfwfrgwGkgjMMU8FjJcfFrD8myvI6TUM/BlY EEpG826htuaWYH+wFTWxPjS+uS/BEU/e9sYlC4xzPqchCBzrdPJJwBEHonvbl/2RKMVH a5P0lVjLn0NLUheWBDhXusEdzTnaDCJPoIYEUxeMxD1EADq9/ar6XSUUff4AKI6fW3aO jyXLvcpho15OpAmsHM2FeGbn1zGtMwB5TKOnFbdTT8aWO9m1+M+1gmnmgKtGJiLT+y5b I2Dw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.b=D+IhY8T8; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::241 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com. [2607:f8b0:400e:c00::241]) by gmr-mx.google.com with ESMTPS id k86si482740pfj.12.2017.07.12.04.44.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 04:44:08 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::241 as permitted sender) client-ip=2607:f8b0:400e:c00::241; Original-Received: by mail-pf0-x241.google.com with SMTP id e199so2926592pfh.0 for ; Wed, 12 Jul 2017 04:44:08 -0700 (PDT) X-Received: by 10.99.2.213 with SMTP id 204mr3398446pgc.180.1499859848227; Wed, 12 Jul 2017 04:44:08 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id b78sm6736966pfk.71.2017.07.12.04.44.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Jul 2017 04:44:07 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id C473CA1C5; Wed, 12 Jul 2017 07:43:56 -0400 (EDT) Content-Disposition: inline In-Reply-To: <9a1c3693-5d46-4de0-921b-3408ca893bad-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-PGP-Key: http://johnmacfarlane.net/jgm.asc X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.b=D+IhY8T8; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::241 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:17898 Archived-At: I can modify the LaTeX reader so it handles this special case better. (A LaTeX control sequence must be a sequence of letters -- here the '18' specifies a file handle, I think.) In the mean time, try defining a macro synonym: \newcommand{\mywrite}[1]{\write18{#1}} and then use `\mywrite`. +++ sven.androd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [Jul 12 17 01:10 ]: > Hi everyone! > I'm using the LaTeX command "\write18{}" to be able to issue commands > directly when compiling the document. However, when I'm trying to > convert from Markdown to LaTeX, the "write18 {}" command gets escaped > and therefore can't be processed by LaTeX. > Example (Markdown file, temp.md): > # This is a section > Capturing the output of a command with `write18`. > ## Description > Some examples where the content does not get escaped: > \section{git --version} > \input{git --version} > \write{git --version} > Some examples where the content gets escaped: > \immediate\write18{git --version} > \write18{git --version} > This gets compiled down to (pandoc --to latex temp.md) > \section{This is a section}\label{this-is-a-section} > Capturing the output of a command with \texttt{write18}. > \subsection{Description}\label{description} > Some examples where the content does not get escaped: > \section{git --version} > \input{git --version} > \write{git --version} > Some examples where the content gets escaped: > \immediate\write18\{git --version\} > \write18\{git --version\} > As you can see, the "\write18{git --version}" command gets compiled > down to "\write18\{git --version\}" that's escaped and therefore cannot > be processed by LaTeX. > This seems to have something to do with the Markdown reader, since if > you print out the JSON AST, each input gets treated separately. > Output of "pandoc --to json temp.md | python -m json.tool" > ... > { > "c": [ > { > "c": [ > "tex", > "\\write" > ], > "t": "RawInline" > }, > { > "c": "18{git", > "t": "Str" > }, > { > "t": "Space" > }, > { > "c": "--version}", > "t": "Str" > } > ], > "t": "Para" > } > ... > Now to my actual question: is this expected behavior or some kind of > missing token definition? And if so; how would I work around it? > I'd rather not write a Pandoc filter that would process the entire AST, > but if the above behavior is expected I guess that's a solution that > could work. Otherwise, does anyone else have any suggestions? > Thank you > Best regards, > Sven > > -- > You received this message because you are subscribed to the Google > Groups "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to > [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > [3]https://groups.google.com/d/msgid/pandoc-discuss/9a1c3693-5d46-4de0- > 921b-3408ca893bad%40googlegroups.com. > For more options, visit [4]https://groups.google.com/d/optout. > >References > > 1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 3. https://groups.google.com/d/msgid/pandoc-discuss/9a1c3693-5d46-4de0-921b-3408ca893bad-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer > 4. https://groups.google.com/d/optout