From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HK_RANDOM_FROM,HTML_MESSAGE, MAILING_LIST_MULTI,URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1152 invoked from network); 16 Sep 2023 20:31:02 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 16 Sep 2023 20:31:02 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 80E49483000 for ; Sat, 16 Sep 2023 22:30:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LZqbRYN3KfBp for ; Sat, 16 Sep 2023 22:30:01 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id EFC0F4830F2 for ; Sat, 16 Sep 2023 22:29:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id E3221482DF2 for ; Sat, 16 Sep 2023 22:28:47 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U4Ybi9VDXBDI for ; Sat, 16 Sep 2023 22:28:47 +0200 (CEST) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 91389482DA9 for ; Sat, 16 Sep 2023 22:28:47 +0200 (CEST) Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-564b6276941so2658316a12.3 for ; Sat, 16 Sep 2023 13:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694896125; x=1695500925; darn=ntg.nl; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=b/dneFT76LYCIoLuH6UO9TdueSW+uj70IMJ6OZSyOns=; b=eWuEU22B3IkNfZQdKVyNZz+vsguroN0wzIkMUDKtrYYfkdmdJAHmraPn+9NEv4mUCP GHnaRlV8p8bWG1ayAv1ppjTU4xOdR6nc+4mhJzLd2bQtK6sYv8hG7uxBEdyyKOaG1ETq pHHBWb4JJ6/bUy7+idnTpkTTDIxYHrpxyBNS54gdJFanySiRDYulwGo3m9awKFOhyrp+ LGf00fLKzUT7gtKwyPinNS0euk6AqGklUxTOaZO+gAUyDdKPR53D/vuzv9wMMOcmFgLZ 7cVOlRN1lpz/CdMjiMzzgAKqZ7VxQqHhMAZ58zdlh+r8CXJhfhafQVI8WrYpR3LcpATF yxKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694896125; x=1695500925; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=b/dneFT76LYCIoLuH6UO9TdueSW+uj70IMJ6OZSyOns=; b=hp0ayT3/83F/N+wmPjBMc/D0HqKaEc6MucO9p58x03j56/ju9pI8n3rYbAnuglYSHB EWrtUDN1Np3HQXV62kZuGlq9D9yJeixZsRD7GMe3i2IaChtwtgFRT3C3NCHpn3bscqsv ZI0C+HpKWcwKT+I3Vht3GseRq5le+pJpIyf11J17joD2RjumT5jHPISm7Y3ZlWl5RSqP RiwvI01DJX3K91AfPxDYCLP5CH7rKPbZ/xwdo9K/XuY32+LLFRW8w3xMFXr10Y4nSZc2 1GzimJ/s61Svfq4E6wanF5fhI4YbPky4NpOoV8A3+wfsADG2+JGYQa/a74IuYmDpLSC3 0xbg== X-Gm-Message-State: AOJu0YxU/BecG6ArKvi1JkfhQ5qaqZYcgh34Ii6AWH0LlKzdLJBjtgAu XTZyfcrdUUxpDxbsc/k2+Q0THTzSYOSIXyGBC35SC/Rikkw= X-Google-Smtp-Source: AGHT+IHAhGsyZKTHTeCkpduOpm6EvGc8cKi6kSxex57+LKT9svAoZBaTS9beAHPCbFRErebGBYG/8QfNRUoFY+tz6CQ= X-Received: by 2002:a17:903:2582:b0:1c0:7bac:13d4 with SMTP id jb2-20020a170903258200b001c07bac13d4mr4300814plb.65.1694896125149; Sat, 16 Sep 2023 13:28:45 -0700 (PDT) MIME-Version: 1.0 From: Jeroen Date: Sat, 16 Sep 2023 22:28:35 +0200 Message-ID: To: mailing list for ConTeXt users Message-ID-Hash: OR3QWGQJMLDIZBFFLI2ADMVVDEPDOHAT X-Message-ID-Hash: OR3QWGQJMLDIZBFFLI2ADMVVDEPDOHAT X-MailFrom: contextntg@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Framed Text with Chapter Numbers as Counter List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============4360411706839959096==" --===============4360411706839959096== Content-Type: multipart/alternative; boundary="0000000000007886ea06057fc18c" --0000000000007886ea06057fc18c Content-Type: text/plain; charset="UTF-8" This MWE has a framed text for some verbatim text (code) with as title ref. a counter 1, 2, etc.. Is there a way to change this frame text title as following with the chapter number and a sequential number and the title. Code Fragment 1.1 (The First Title) Code Fragment 1.2 (The Second Title) Code Fragment 2.1 (The Third Title) MWE: \startuseMPgraphic{CountFrame} picture p; numeric w, h, o; p := textext.rt("\wrappedcurrentconstruction"); w := OverlayWidth; h := OverlayHeight; o := BodyFontSize; p := p shifted (2o,h-ypart center p); draw p; path b; b := boundingbox p enlarged (o/10); drawoptions (withpen pencircle scaled 1pt withcolor black); draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner b,h); draw b; setbounds currentpicture to OverlayBox; \stopuseMPgraphic \defineoverlay [CountFrame] [\useMPgraphic{CountFrame}] \defineframedtext [CountFramedText] [frame=off, background=CountFrame, offset=\bodyfontsize, width=\textwidth, % style={\switchtobodyfont[11pt,tt]}] bodyfont=11pt, style={\tt}, ] \def\FrameTitle#1% {\setMPtext{CountFrame} {\hbox spread 1em{\hss\strut#1\hss}}}\setMPtext{CountFrame} {} \defineenumeration [Counter] [title=yes, alternative=empty, before=\startCountFramedText, after=\stopCountFramedText] \starttext \startchapter [title=first] \startCounter [title={The First Title}, reference={tit1}] Some verbatim text \stopCounter \startCounter [title={The Second Title}, reference={tit2}] Some verbatim text \stopCounter Refer to \in{code fragment}[tit1] bla \stopchapter \startchapter [title=second] \startCounter [title={The Third Title}, reference={tit3}] Some verbatim text \stopCounter \stopchapter \stoptext --0000000000007886ea06057fc18c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This MWE has a framed text for some verbatim text (code) w= ith as title ref. a counter=C2=A01, 2, etc.. Is there a way to change this = frame text title as following with the chapter number and a sequential numb= er and the title.

Code Fragment 1.1 (The First Title)
Code Fragment 1.2 (The Second Title)
<= div>
Code Fragment 2.1 (The Third Title)

MWE:

\startuseMPgraphic{CountFrame= }
=C2=A0 picture p; numeric w, h, o;
=C2=A0 p :=3D textext.rt("\= wrappedcurrentconstruction");
=C2=A0 w :=3D OverlayWidth; h :=3D Ov= erlayHeight; o :=3D BodyFontSize;
=C2=A0 =C2=A0 p :=3D p shifted (2o,h-y= part center p);
=C2=A0 =C2=A0 draw p;
=C2=A0 =C2=A0 path b;
=C2=A0= =C2=A0 b :=3D boundingbox p enlarged (o/10);
=C2=A0 =C2=A0 drawoptions = (withpen pencircle scaled 1pt withcolor black);
=C2=A0 =C2=A0 draw (2o,h= )--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner b,h);
=C2=A0 =C2=A0 draw = b;
=C2=A0 =C2=A0 setbounds currentpicture to OverlayBox;
\stopuseMPgr= aphic

\defineoverlay
=C2=A0 [CountFrame]
=C2=A0 [\useMPgraphic= {CountFrame}]

\defineframedtext
=C2=A0 [CountFramedText]
=C2= =A0 [frame=3Doff,
=C2=A0 =C2=A0background=3DCountFrame,
=C2=A0 =C2=A0= offset=3D\bodyfontsize,
=C2=A0 =C2=A0width=3D\textwidth,
% =C2=A0 sty= le=3D{\switchtobodyfont[11pt,tt]}]
=C2=A0 =C2=A0bodyfont=3D11pt,
=C2= =A0 =C2=A0style=3D{\tt},
=C2=A0 =C2=A0]

\def\FrameTitle#1%
=C2= =A0 {\setMPtext{CountFrame}
=C2=A0 {\hbox spread 1em{\hss\strut#1\hss}}}= \setMPtext{CountFrame}
=C2=A0 {}

\defineenumeration
=C2=A0 [Co= unter]
=C2=A0 [title=3Dyes,
=C2=A0 =C2=A0alternative=3Dempty,
=C2= =A0 =C2=A0before=3D\startCountFramedText,
=C2=A0 =C2=A0after=3D\stopCoun= tFramedText]

\starttext

\startchapter
=C2=A0 [title= =3Dfirst]

\startCounter
=C2=A0 [title=3D{The First Title},=
=C2=A0 =C2=A0reference=3D{tit1}]
=C2=A0 =C2=A0Some verbatim text
= \stopCounter

\startCounter
=C2=A0 [title=3D{The Second Title},=C2=A0 =C2=A0reference=3D{tit2}]
=C2=A0 =C2=A0Some verbatim text
\st= opCounter

Refer to \in{code fragment}[tit1] bla

\stopchapter<= /div>

\startchapter
=C2=A0 [title=3Dsecond]

\startCounter
=C2=A0 [title=3D{The Third Tit= le},
=C2=A0 =C2=A0reference=3D{tit3}]
=C2=A0 =C2=A0Some verbatim text=
\stopCounter

\stopchapter

\stoptext
--0000000000007886ea06057fc18c-- --===============4360411706839959096== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ --===============4360411706839959096==--