From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31671 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?V=C3=ADt_Novotn=C3=BD?= Newsgroups: gmane.text.pandoc Subject: Re: Plain TeX writer Date: Wed, 2 Nov 2022 07:17:46 -0700 (PDT) Message-ID: <9dfc8b26-3fda-4882-93b7-06d44671ef7fn@googlegroups.com> References: <51539828-c876-437b-bb1e-a5efcf752762n@googlegroups.com> <84C142C7-20EF-411E-AF94-D0AA008FA9DA@gmail.com> <24c01860-2f35-4ff0-9d31-63d10f764f79n@googlegroups.com> <1EC34FB9-2344-40AC-91CD-22B3D9069EE6@gmail.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1726_1952315082.1667398666244" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14958"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDONFQGBUMIRBC7YRGNQMGQE4NFBULI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Nov 02 15:17:51 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oa1-f60.google.com ([209.85.160.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oqEYx-0003be-D6 for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 02 Nov 2022 15:17:51 +0100 Original-Received: by mail-oa1-f60.google.com with SMTP id 586e51a60fabf-13c6efaa955sf8112595fac.11 for ; Wed, 02 Nov 2022 07:17:51 -0700 (PDT) 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-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=4UqOUgqYWAgYXVP7+N11Ph3ybR0XHYDVxCyaBB6WShk=; b=R+++wXBmNyFthaQq0Qm2kZv/bE3RMaMtkx0Io/mn63WJ0hxUYsKiTiVjLtLfIC90Dw /8Hfma6nd91zIm09JK0A0mhpigH78TB7k+PB9R2GkJjlrPAp1sqNEXPfMYu3/PT+mvU1 Hp8Ja59M0m5xjJJq3DmB6jA3AVHd0Po6CqZtvc36xbAH4XdbsM5XpTmbPlVvj+bFVId/ ifpvIm5ZcX3vk6O3AGvDx1AAxZ55lT72OVMzuSyGyqEYU601u4iNhNXiWMyPCkjYn7Ch 6MtNKUYZ508KbzGpF6ODmLq8F6cZynFA43D28V+ye2j+hjdbAZeSmu5DkpX8aOYIs53Z QPvg== 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-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=4UqOUgqYWAgYXVP7+N11Ph3ybR0XHYDVxCyaBB6WShk=; b=OKFysQOEx4zxnypsV7sNPV6wCuzGvB4/PMyLbl8HIN/3C110Hl8WL2nZZBnKEAE58u prYkc1iXJbD1AqecaFokYzZvVgfW487nCBOkAwIFYRCsv6mDcLUDzz7A7FAbLwV0vKhX ib5OhWgf962J2H3OHreHLiK/3+p0CwRamlYsfKE1NDzONk/OANZZeSpQn0CO9pNmvGof OVSXGRqvUN0AJbiED5srMOxH1D2gcCQS71G0h8K3/IVHCtG6bEa+irCG7zYuPCzpy7l4 zdn3cpZCkM1mVoOl9sas7zi21KxmkU/p9bs2mbWm9AFtonUFQxsePiv4F+rA+Kh0d27v U+aA== 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-sender:mime-version:subject:references:in-reply-to :message-id:to:from:date:x-gm-message-state:sender:from:to:cc :subject:date:message-id:reply-to; bh=4UqOUgqYWAgYXVP7+N11Ph3ybR0XHYDVxCyaBB6WShk=; b=7XgEKx6L+d8GWwI72eUvAkvzmltlTpM3e/aB1Go8kRKiZQDfqT1Z2EFnQ2BIoA/gZ2 hUkTzkkW3yPHIkDo0SqAYwBEfBYBuUBtMXIFnDsmFW2VlHXNCte4GzoJb8yUNXsC8ewa x4eCtagQ7E0xtjGQj+EegduS1mZOjHA0WPgnmMTUOym5fIOsKJrQWsv75UMegV6VfprE KLb8+8yrQLiEG0HzrOQJyG8FEicP0mjx/DcJS2vR6xAzBfKGHQnEAAW2VUOKoHTpIQ1r cJcLA8SzjtrjeRowsRbEDEQ5ajBMWdrGCbnWPnwhCTAWiWjYt36LMtWzTmPD8medOIgN aT6A== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ACrzQf1G65QVKq8cl2rZLBqGOZ4ujyGGuyeGePzfDvLge42OBGC9mHgN Y1h7YoLqdaM49KBPA8yOnG0= X-Google-Smtp-Source: AMsMyM72bfkiESHZCK/S9hdsZIxTLNyUM8lumDBW3Cufg+bVzGJERn2Ez9TOFneEAR8A7Qkr6sBU2Q== X-Received: by 2002:a05:6870:7027:b0:13b:a5b7:165a with SMTP id u39-20020a056870702700b0013ba5b7165amr24051012oae.194.1667398670059; Wed, 02 Nov 2022 07:17:50 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:a8ae:b0:136:8a4d:f0b3 with SMTP id eb46-20020a056870a8ae00b001368a4df0b3ls5282950oab.11.-pod-prod-gmail; Wed, 02 Nov 2022 07:17:47 -0700 (PDT) X-Received: by 2002:a05:6870:7a4:b0:131:fe02:4c74 with SMTP id en36-20020a05687007a400b00131fe024c74mr23782496oab.104.1667398667288; Wed, 02 Nov 2022 07:17:47 -0700 (PDT) In-Reply-To: X-Original-Sender: witiko-Re5JQEeQqe8AvxtiuMwx3w@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.io gmane.text.pandoc:31671 Archived-At: ------=_Part_1726_1952315082.1667398666244 Content-Type: multipart/alternative; boundary="----=_Part_1727_1802829815.1667398666244" ------=_Part_1727_1802829815.1667398666244 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > So, for example, you couldn=E2=80=99t make Spaces appear as visible =E2= =90=A0=20 characters, and you couldn=E2=80=99t make SoftBreaks create hard breaks in = the=20 output. Replacing *\pandocSpace* with ASCII spaces makes it difficult to reprogram= =20 spaces on the top level of the document, but we can definitely substitute= =20 spaces in parameters of commands such as *\pandocCode*, which would cover= =20 many (if not most) use cases. The following example LaTeX document produces the text=20 *we=E2=90=A3want=E2=90=A3visible=E2=90=A3spaces=E2=90=A3here* in a monospac= ed font: *\documentclass{standalone}\usepackage{xparse}\ExplSyntaxOn\ProvideDocument= Command =20 { \pandocCode } { m } { \pandoc_code:n { #1 } }\cs_new:Nn =20 \pandoc_code:n { \tl_set:Nn \l_tmpa_tl { #1 } =20 \regex_replace_all:nnN { \s } { \c{textvisiblespace} } =20 \l_tmpa_tl \texttt { \l_tmpa_tl } =20 }\ExplSyntaxOff\begin{document}\pandocCode{we want visible spaces=20 here}\end{document}* > There may also be line breaks in the source that don't correspond to=20 SoftBreak. Any lines that end with a comment character (%) will skip over the newline= =20 character. Therefore, we can have newlines in the source code that wouldn't= =20 trigger the active newline character. The following example plain TeX document produces the text *foo bar baz*: *\catcode`\^^M=3D13* *\def^^M{ bar }%foobaz%* *\bye* Dne =C4=8Dtvrtek 27. =C5=99=C3=ADjna 2022 v 19:09:30 UTC+2 u=C5=BEivatel fi= ddlosopher napsal: > > > On Oct 27, 2022, at 12:07 AM, Bastien DUMONT =20 > wrote: > >=20 > > Fortunately, it is possible by making the space and the newline=20 > characters active in TeX! (Provided that a SoftBreak is rendered as a lin= e=20 > break in the TeX output.) This is how \obeylines and \obeyspaces work. > > But this might not be what you want; after all there are going to be=20 > spaces in code blocks, and you might not want to treat them the same way= =20 > (they do not correspond to pandoc Space elements). There may also be line= =20 > breaks in the source that don't correspond to SoftBreak. > > > --=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/9dfc8b26-3fda-4882-93b7-06d44671ef7fn%40googlegroups.com. ------=_Part_1727_1802829815.1667398666244 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable >  So, for example, you couldn=E2=80=99t make Spaces appear as visible =E2=90= =A0 characters, and you couldn=E2=80=99t make SoftBreaks create hard breaks= in the output.

Replacing \pandocSpace with ASCII= spaces makes it difficult to reprogram spaces on the top level of the docu= ment, but we can definitely substitute spaces in parameters of commands suc= h as  \pandocCode, which would cover many (if not most) use cases.

The following example LaTeX document produces the text we=E2=90=A3want=E2=90=A3visible=E2=90=A3spaces=E2=90=A3here in a = monospaced font:

\documentclass{standalone}
= \usepackage{xparse}
\ExplSyntaxOn
\ProvideDocumentCommand
  {= \pandocCode }
  { m }
  { \pandoc_code:n { #1 } }
\cs_n= ew:Nn
  \pandoc_code:n
  {
    \tl_set:Nn \l_t= mpa_tl { #1 }
    \regex_replace_all:nnN
    &nbs= p; { \s }
      { \c{textvisiblespace} }
   =   \l_tmpa_tl
    \texttt { \l_tmpa_tl }
  }
\= ExplSyntaxOff
\begin{document}
\pandocCode{we want visible spaces her= e}
\end{document}


>  There may also be line breaks in the source that don't correspond to SoftBr= eak.

Any lines that end with a comment character (= %) will skip over the newline character. Therefore, we can have newlin= es in the source code that wouldn't trigger the active newline character.

The following example plain TeX document produces t= he text foo bar baz:

\catcode`\^^M=3D13\def^^M{ bar }%
foo
baz%
\bye

Dne =C4=8Dtvrtek 27. =C5=99=C3=ADjna 2022=C2=A0v=C2=A019:09:30 UTC+2= u=C5=BEivatel fiddlosopher napsal:

> On Oct 27, 2022, at 12:07 AM, Bastien DUMONT <bastien...-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org> wrote:
>=20
> Fortunately, it is possible by making the space and the newline ch= aracters active in TeX! (Provided that a SoftBreak is rendered as a line br= eak in the TeX output.) This is how \obeylines and \obeyspaces work.

But this might not be what you want; after all there are going to be sp= aces in code blocks, and you might not want to treat them the same way (the= y do not correspond to pandoc Space elements). There may also be line brea= ks in the source that don't correspond to SoftBreak.


--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/9dfc8b26-3fda-4882-93b7-06d44671ef7fn%40googlegroups.= com.
------=_Part_1727_1802829815.1667398666244-- ------=_Part_1726_1952315082.1667398666244--