From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31597 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: Plain TeX writer Date: Wed, 19 Oct 2022 08:43:25 -0700 Message-ID: <84C142C7-20EF-411E-AF94-D0AA008FA9DA@gmail.com> References: <51539828-c876-437b-bb1e-a5efcf752762n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18544"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDW7ZIEHTIIBBINWYCNAMGQE5C2FQFA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Oct 19 17:43:32 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qv1-f61.google.com ([209.85.219.61]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1olBEC-0004fc-FK for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 19 Oct 2022 17:43:32 +0200 Original-Received: by mail-qv1-f61.google.com with SMTP id i7-20020a0cab47000000b004b4376895bfsf11031808qvb.20 for ; Wed, 19 Oct 2022 08:43:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666194211; cv=pass; d=google.com; s=arc-20160816; b=MSLeT3xAy04PYz0TCVQP+C76SRT2Ha+FlJ1I2yTlvV1jW2RMlEE3z1NZdYiAGas7ct DpQ4K91ojk8M3feF6VciPLdmCP/wiS41lVN2+uETYAM2zxmKHSfDKweskP/XHzH2ycFu qxZ0+AUZ1Kk/FAGJAmdZJ3OnSp3BXOzWRywXjNj95vPpzLtK5rJn70TQBnxIRYDwlBow gBCSL7gMA+hWTmZhvwl2BNrHCSb8l9/9i4XHweiCmDgyyeR1BkPlWIGQp9JBekj831BF wckmnOCCMbERfrWSPzZfpiVcT3qx8fDXzB3ROJOhiqV+cxWCkPFkasfB2IK1geKLYVmS Fn8g== 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:message-id:in-reply-to:to :references:date:subject:mime-version:content-transfer-encoding:from :sender:dkim-signature:dkim-signature; bh=ULGpOTg+KrhgHcLE/zb9LTWD1CNVFQ4sEzEc5xhonoc=; b=bxmBsQKvaWB9wjgjIPXm5Krqh6T0qP52xFbLnSyr7KOpkwbXxpW/Aro0SVmIcyWQUG cNxtM/lakXqF18V8b78FclVdOEUsRJXm/w+HSbNLsOVgj6Zpv9oRXVdBBOqD1jgKUcyY XZuj2vSMsW2Vc+EWPSI57firwuyP1S8cmmQC0p3xpEHd4ATOReVGza5EuRiRH5MymG5/ hhLo1t5oPEprdipMOQ4pJgkOPeX26YhHqOeWoJOFkgobqCvHNeDlr5w1Kg3ZcCZ+1SY8 pTI3szNN5/X/LfeOuT7lcDpCD/omEVK2lqGKZJuwAjZ2xO+PVUmJXq6MZj1Gr7K7/agg B1vg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Fo/AQeis"; spf=pass (google.com: domain of fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::432 as permitted sender) smtp.mailfrom=fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:message-id :in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=ULGpOTg+KrhgHcLE/zb9LTWD1CNVFQ4sEzEc5xhonoc=; b=P6N0Z3BFVE1WlD0Z56ZymXFlyu6D45mUrynZMhO1M8+fSo0gb82MJDSeOCzhQruUGC Nz7T1ehRUU1pvNWK81xeSGgLoP/Gmx4EdHVr6TQGEiV5k0NQ2Pz/W7hn0uJs+vnRB8P3 y+igzL7ipnwqFY0qw4+4ev/wiyd2zbsJQ5C7px5OSOicKi/+3Edh1Fbi+bKYY+3npZy/ AvvJQnj6cPkMfgoSXtoVcWSuL6LzwfRnGee6gsYpsJQoTyBMk+H+YFdmoL8h5+e69r9n X+weWMpK8CNLRTcW4lm/VyfjlzGhirVh6yQjMDyl9H40eEYk5S/fky8nxgE9PXNxJ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:message-id :in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=ULGpOTg+KrhgHcLE/zb9LTWD1CNVFQ4sEzEc5xhonoc=; b=T1yc5a6vlSsiMPKviyOmSDqpb2hVoolXbV8FypKjFHIlj4fFAcJvYHKA1QQF9mXDa8 PhXMcQxzEVVMSM2C7mI2h2BG+wtZuUm85QXSIKGzVgVwBfRh/8VuxcXnSSnAE+q8M+dG rSwPpf2cN6VA6Ohvb3P57EFXkacitqLhxoiKS7lKXR/J6Qym63YyTtTkVPtTHQEHO8sV CHdPs9sWiUyD5PhMjRbHh3vTtjR5bsgnuqEgwcrWm1CHJnkEgrivhy0Rgxgkt6mbfQ6a zhDz8ou0QXY9xM/ZPlQ5Zppo3xCOw59RDwvZlkPDcnOVS51pyfzBHFYUxrrb1iDg3Ez1 c X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:message-id :in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:sender:from:to:cc :subject:date:message-id:reply-to; bh=ULGpOTg+KrhgHcLE/zb9LTWD1CNVFQ4sEzEc5xhonoc=; b=SNmqIN6FqkAISvvi4Q8d0mbpOogu8vCubKglm4CeXVYpVIM7D4N5RLUdW40ISCE0KB z04qFWhtXOMZfO+RnyYmzg11dDRQY3QuBvdQALcOFm0OX0V0LPmD2eFl+N0m+48fCuA9 uzhduo+4qK1I8ItVnIDikFqH9eiQqqXkqjOesSZi0kZhEFeSyxRBbbdBLffFRZSJbEFP uAe3Fiw61MiWdaRy0MMyITCn4ox4grdQXtadDETWK9FC3gJfCqb86dl4J+P5aNSepbgv K5UsbhtLaJn0DNcch3Nd Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ACrzQf2031RSwrixczUm7ifhoClyxHM/V4LHGe7NcrUZd2w23iNbQF66 yoiiD/YMmn2SgvPdXTtdYZI= X-Google-Smtp-Source: AMsMyM6TF2Hq6PwnGgGlt0sUxT2cJxBk2RamQv+qULqOYsU06LayQL224CU+jI2cRAh58PA1LsVbUg== X-Received: by 2002:ae9:ed47:0:b0:6ea:1443:8c0a with SMTP id c68-20020ae9ed47000000b006ea14438c0amr6055221qkg.302.1666194211439; Wed, 19 Oct 2022 08:43:31 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a37:e30c:0:b0:6ce:8725:d09 with SMTP id y12-20020a37e30c000000b006ce87250d09ls11774877qki.1.-pod-prod-gmail; Wed, 19 Oct 2022 08:43:29 -0700 (PDT) X-Received: by 2002:a05:620a:1a94:b0:6ee:d395:663e with SMTP id bl20-20020a05620a1a9400b006eed395663emr6119470qkb.632.1666194209075; Wed, 19 Oct 2022 08:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666194209; cv=none; d=google.com; s=arc-20160816; b=qhxD5mUjAA1VoVhzqDlUId6yisTWWu9kJjP6m05RiuSExXIVgb4zpLE2v7bTh3uDUg YxvlptbtGzJhpu9hcZWvMwWIN0Ud0l68eYuFsco6ErBsNRT1iFUGAdPmPvHlD/otsbrv Pv7dREwvXwwgeC9HRDlG+jNSviKm4JtacpvDy2lrqr0wjsPkLlqxKMhXzaQm6XhfVXZf XCU0Kj0EkRSEWVJDjYGyoVpp0zK4j2rxEdOsmjqLODjhEi93Cd9uZq4v12lbwZRO6dcm 19d7DntfkEcZ3L9Lox8UvlEXn4WB9bhvDlH2f2BgUQGYjlC8LupWK5yK4L//8Si5+nTn S0fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:dkim-signature; bh=alX/7er22Nmf0j7sBlhdpN28BZpKMEiGMDDnW+51Vys=; b=vNe7HZ7dxBN50lUnG3zu5SmV18+NHAFvOLht4GZULkUd+XQ3WMf1WGsHSXE2gWyTAB jIfrvb0IBLOrthq7ggBuNMZLUpGpwd2giUq55kERT5cHhvWsx3oBuyUsfzPMW3k76sTa pR9vMzUHstU9g519nUKQX+5gMQtmY71durDQ9YGHUHkiA2y9ewapg3pImazhuDwEUZpw IJMEYeAzKlhp+XSqUVRC8ci5khOK3iLR6y+luTOFfF5P2sWX2aNbef2r0tWAfeM+Qhex ilL+opJbDTE/DdQKSTDvi48LsDNAD2TSYCK57RVZZYApg8YRx8oNSBQ6IXTKsgACwoks AoZw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Fo/AQeis"; spf=pass (google.com: domain of fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::432 as permitted sender) smtp.mailfrom=fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com. [2607:f8b0:4864:20::432]) by gmr-mx.google.com with ESMTPS id 17-20020a05620a071100b006eea4b5abb0si673588qkc.0.2022.10.19.08.43.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 08:43:29 -0700 (PDT) Received-SPF: pass (google.com: domain of fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::432 as permitted sender) client-ip=2607:f8b0:4864:20::432; Original-Received: by mail-pf1-x432.google.com with SMTP id 67so17577783pfz.12 for ; Wed, 19 Oct 2022 08:43:29 -0700 (PDT) X-Received: by 2002:a65:6d89:0:b0:421:94bc:cb89 with SMTP id bc9-20020a656d89000000b0042194bccb89mr7687461pgb.129.1666194207770; Wed, 19 Oct 2022 08:43:27 -0700 (PDT) Original-Received: from smtpclient.apple ([2601:644:400:7c40:589c:6889:df15:2b9d]) by smtp.gmail.com with ESMTPSA id w186-20020a6262c3000000b00561d79f1064sm11509269pfb.57.2022.10.19.08.43.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2022 08:43:26 -0700 (PDT) In-Reply-To: <51539828-c876-437b-bb1e-a5efcf752762n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Original-Sender: fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Fo/AQeis"; spf=pass (google.com: domain of fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::432 as permitted sender) smtp.mailfrom=fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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.io gmane.text.pandoc:31597 Archived-At: I like the idea of including a plain TeX writer in pandoc, and these Lua ex= periments will be helpful. (Btw, when we go to 3.0, modifying the old-styl= e Lua writer to work as a new-style writer will only take a line or two of = code.) What would you think about replacing \pandocSpace with a regular space char= acter? IT would make the output a lot more readable. Similarly, SoftBreak = could be a regular newline character. It would be nice to see some examples involving arguments and attributes, e= .g. links and headers. Why is the package called "pandoc-to-markdown"? That would lead me to expe= ct that it produces markdown output. John > On Oct 19, 2022, at 6:59 AM, V=C3=ADt Novotn=C3=BD wro= te: >=20 > In pull request #1541, John MacFarlane floated the idea of having a Pando= c writer whose output could be =E2=80=9Cprocessed by plain tex (or perhaps = eplain), without latex or context macros.=E2=80=9D In their proof of concep= t, Dominik Reh=C3=A1k explores what this would look like in practice.=20 >=20 > Dominik=E2=80=99s proof of concept contains a custom Lua writer pandoc-to= -markdown.lua that you can use as follows:=20 >=20 > $ cat > example.md > Under his pillow P'raps found =20 > ~~A cake that weighed a half a pound.~~ =20 > A plenty of space to roll around. >=20 > $ pandoc -i example.md -f pandoc-to-markdown.lua -o example.tex > $ cat example.tex > \pandocDocumentBegin > Under\pandocSpace{}his\pandocSpace{}pillow\pandocSpace{}P=E2=80=99raps\pa= ndocSpace{}found\pandocLineBreak > \pandocStrikeout{A\pandocSpace{}cake\pandocSpace{}that\pandocSpace{}weigh= ed\pandocSpace{}a\pandocSpace{}half\pandocSpace{}a\pandocSpace{}pound.}\pan= docLineBreak > A\pandocSpace{}plenty\pandocSpace{}of\pandocSpace{}space\pandocSpace{}to\= pandocSpace{}roll\pandocSpace{}around. > \pandocDocumentEnd >=20 > To typeset the example document, you can use a macro package that defines= how the various \pandoc... commands should be formatted. For LaTeX, the pr= oof of concept contains the pandoc-to-markdown.sty style file that you can = use as follows:=20 >=20 > $ cat > example.ltx > \documentclass{article} > \usepackage{pandoc-to-markdown} > \begin{document} > \input example.tex > \end{document}=20 >=20 > $ pdflatex example.ltx >=20 > Here is the output document example.pdf: >=20 > >=20 > The proof-of-concept contains many more examples for you to try out in th= e examples/ directory. >=20 > Dominik's work is part of their bachelor's thesis, which is to appear thi= s fall. Dominik has already published two articles about their work in hobb= yist journals: the CSTUG Bulletin 31:1=E2=80=934 (in Slovak, see a machine = translation to English) and in TUGboat 43:1 (see Section 2.3). The implemen= tation rests on my Markdown package for TeX, which provides formatting for = most elements of the Pandoc AST across different TeX formats such as plain = TeX, LaTeX, and ConTeXt.=20 >=20 > Here are some limitations of the proof of concept: >=20 > =E2=80=A2 For the sake of convenience, some of the \pandoc... commands t= hat we produce are in a form that closely mimics the commands provided by t= he Markdown package rather than Pandoc=E2=80=99s AST. For example, the \pan= docCode, \pandocLink, and \pandocHeader commands discard attributes, the \p= andocImage and \pandocCaptionedImage commands receive parameters with TeX= =E2=80=99s special characters escaped in a way required by the Markdown pac= kage, and the LineBlock element of Pandoc=E2=80=99s AST is simulated by a s= eries of \pandocLineBreak commands. >=20 > In the future, we would like to make the \pandoc... commands closer to t= he Pandoc=E2=80=99s AST, so that a lossless round trip from AST to TeX and = back is possible. In TeX, we can process text using regular expressions (se= e the l3regex module of the expl3 macro package), which allows us to move m= ost parameter preprocessing code from our Lua writer to the definitions of = the \pandoc=E2=80=A6 commands. >=20 > =E2=80=A2 The custom Lua writer pandoc-to-markdown.lua uses the old-styl= e custom Lua writer API that will no longer be supported in Pandoc 3.0.0. W= e would like to rewrite the custom Lua write to Haskell, so that it can bec= ome an integral part of Pandoc independent of Pandoc=E2=80=99s Lua API. >=20 > In the future, the ConTeXt and LaTeX writers of Pandoc could be replaced = by a single writer that would produce format-agnostic TeX code. Formatting = for the TeX code would then be provided by format-specific TeX macro packag= es such as the pandoc-to-markdown.sty style file for LaTeX. This approach w= ill reduce the amount of code maintained by Pandoc and increase the number = of supported TeX formats, which is a win-win for both Pandoc maintainers an= d Pandoc users. Both Dominik and I would be happy to discuss with you how t= o best get there. >=20 >=20 > --=20 > 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 pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgi= d/pandoc-discuss/51539828-c876-437b-bb1e-a5efcf752762n%40googlegroups.com. > --=20 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 e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/84C142C7-20EF-411E-AF94-D0AA008FA9DA%40gmail.com.