From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/107142 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Gerben Wierda Newsgroups: gmane.comp.tex.context Subject: Re: How do I get an empty line in a \framed[align=flushleft]{} item? Date: Fri, 1 May 2020 01:44:37 +0200 Message-ID: <2B421C22-C77E-4AD8-BC4B-968CAA587938@rna.nl> References: <8e0f19c9-fb3f-88d2-3eda-08ad4633fafe@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: multipart/mixed; boundary="===============4013577484135511218==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="39123"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mailing list for ConTeXt users To: Wolfgang Schuster Original-X-From: ntg-context-bounces@ntg.nl Fri May 01 01:45:22 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUIrp-000A6L-SW for gctc-ntg-context-518@m.gmane-mx.org; Fri, 01 May 2020 01:45:21 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 10796183723; Fri, 1 May 2020 01:44:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e8Pm4a37NxFg; Fri, 1 May 2020 01:44:41 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 50343183976; Fri, 1 May 2020 01:44:41 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 33A00183723 for ; Fri, 1 May 2020 01:44:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4ZlahtjWEfyH for ; Fri, 1 May 2020 01:44:38 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=213.125.118.53; helo=mail.rna.nl; envelope-from=gerben.wierda@rna.nl; receiver= Original-Received: from mail.rna.nl (mail.rna.nl [213.125.118.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id EFA601831C6 for ; Fri, 1 May 2020 01:44:37 +0200 (CEST) Original-Received: from hermione.rna.nl (hermione.rna.nl [192.168.2.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.rna.nl (Postfix) with ESMTPSA id 70C793DF1525; Fri, 1 May 2020 01:44:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rna.nl; s=dkim_rsa2048; t=1588290277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=k4oYr/sE3xUqOi6PDRYwUifngm8Bmw4QGykC4IQn3XE=; b=oXZglTRBAGrDV2EhExSWAJJnCT11n2f+6tRnx4zprGl6d3Ygo9iwof1i/ZVVDIaTUQDbBV 80g4zFrAu+lyptBy5UcHfyLy5Mz4cHIbjO8ipx/wJTtQ7j+IisL3JmwhcHCv/diYbt38WF 3MJCqM7PQuOCiTTrk8JeETCJbVx54D12FvWVgQcXy6tidYza6xowmIWeA1RRTDdgvOuzdb Y+1c/shMUgCflaeK5iJNPMe8vbmVkvBQ6VJSBbIO2cs+jpJx+PshrbOHVkzC5h6AiYXWj1 BZdly3z6s2oX4Xaz5piHsQhjgUoH4euY263MWyL9PHq/HzGO4jo/64yghB+31w== In-Reply-To: <8e0f19c9-fb3f-88d2-3eda-08ad4633fafe@gmail.com> X-Mailer: Apple Mail (2.3445.104.14) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:107142 Archived-At: --===============4013577484135511218== Content-Type: multipart/alternative; boundary="Apple-Mail=_33D45828-9EA7-4A46-A4D3-C261D8198BF5" --Apple-Mail=_33D45828-9EA7-4A46-A4D3-C261D8198BF5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 30 Apr 2020, at 22:54, Wolfgang Schuster = wrote: >=20 > Gerben Wierda schrieb am 30.04.2020 um 22:47: >> In normal TeX, when I type >> Aap\\\\Aap >> I get something like >> Aap >> Aap >> But inside a \framed[align=3D]{} the empty line disappears. How do I = get it back? >> Minimal example: >> \starttext >> Testing\\\\Testing >> \page >> \framed[align=3Dflushleft]{Testing\\\\Testing} >> \stoptext >=20 > Use \blank Too happy too soon. And I recall I ran into this earlier a while ago in = another setting ago. But I thought of a solution. Background: I am automatically converting input from an XML file to = METAPOST/ConTeXt. The input may contain one or more newlines.The text = must end up in \framed[align=3D??, width=3D??] to be typeset. I use lua to convert and make it safe to pass to METAPOST as a string = argument that METAPOST can pass on to textext(), using the following = function: function doubleQuotableEscapedConTeXtString( str) local rep =3D lpeg.replacer { { '\n', '\\blank ' }, { '{', '{\\textbraceleft}' }, { '}', '{\\textbraceright}' }, { '#', '{\\texthash}' }, { '$', '{\\textdollar}' }, { '&', '{\\textampersand}' }, { '%', '{\\textpercent}' }, { '\\','{\\textbackslash}' }, { '|', '{\\textbar}' }, { '_', '{\\textunderscore}' }, { '~', '{\\textasciitilde}' }, { '^', '{\\textasciicircum}' }, { '"', "\"&ditto&\"" }, } return rep:match(str) end Where it now says \\blank, it used to say \\\\. Problem \\\\ gets me what I want if there is one \n (it turns into one new = line), but with two \n in succession it still gets me only a single = =E2=80=99newline' \\blank gets me what I want if there are multiple newlines, but gets me = an extra empty line when I only want =E2=80=99next line=E2=80=99 and = multiple \blanks do not work=20 But I found the solution by using \strut\\ instead of \blank. In the = above table: { =E2=80=98\n', =E2=80=98\\strut\\\\' }, This fools ConTeXt in thinking there actually is something on that line = and so multiple \\ will work. G= --Apple-Mail=_33D45828-9EA7-4A46-A4D3-C261D8198BF5 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On = 30 Apr 2020, at 22:54, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:

Gerben= Wierda schrieb am 30.04.2020 um 22:47:
In normal TeX, when I type
Aap\\\\Aap
I get something like
Aap
Aap
But inside a = \framed[align=3D]{} the empty line disappears. How do I get it back?
Minimal example:
\starttext
Testing\\\\Testing
\page
\framed[align=3Dflushleft]{Testing\\\\Testing}
\stoptext

Use = \blank

Too happy too soon. And I recall I ran into this = earlier a while ago in another setting ago. But I thought of a = solution.

Background:

I am automatically converting input from an XML = file to METAPOST/ConTeXt. The input may contain one or more newlines.The = text must end up in \framed[align=3D??, width=3D??] to be = typeset.

I use lua to = convert and make it safe to pass to METAPOST as a string argument that = METAPOST can pass on to textext(), using the following = function:

function = doubleQuotableEscapedConTeXtString( str)
  local rep =3D = lpeg.replacer {
   { '\n', '\\blank ' = },
   { '{', '{\\textbraceleft}' = },
   { '}', = '{\\textbraceright}' },
   { = '#', '{\\texthash}' },
   { = '$', '{\\textdollar}' },
   { = '&', '{\\textampersand}' },
   { '%', '{\\textpercent}' = },
   { = '\\','{\\textbackslash}' },
  =  { '|', '{\\textbar}' },
   { '_', '{\\textunderscore}' = },
   { '~', = '{\\textasciitilde}' },
   { = '^', '{\\textasciicircum}' },
   { '"', "\"&ditto&\"" = },
  = }
  return rep:match(str)
end

Where it now says \\blank, it used to say = \\\\.

Problem

\\\\ gets me what I want if there is one \n (it = turns into one new line), but with two \n in succession it still gets me = only a single =E2=80=99newline'
\\blank gets me what I want if = there are multiple newlines, but gets me an extra empty line when I only = want =E2=80=99next line=E2=80=99 and multiple \blanks do not = work 

But I found the solution = by using \strut\\ instead of \blank. In the above table:

  =  { =E2=80=98\n', =E2=80=98\\strut\\\\' = },

This fools ConTeXt in thinking there actually is something on = that line and so multiple \\ will work.

G
= --Apple-Mail=_33D45828-9EA7-4A46-A4D3-C261D8198BF5-- --===============4013577484135511218== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============4013577484135511218==--