From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: from cgl.ntg.nl (Cgl.ntg.nl [5.39.185.202]) by inbox.vuxu.org (Postfix) with ESMTP id 4C3FE22BA1 for ; Sun, 11 Aug 2024 14:38:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id E5D93484DE8 for ; Sun, 11 Aug 2024 14:37:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Authentication-Results: cgl.ntg.nl (amavisd-new); dkim=fail (2048-bit key) reason="fail (message has been altered)" header.d=gmail.com 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 m70LqLUCVD8b for ; Sun, 11 Aug 2024 14:37:31 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id C11E0484D91 for ; Sun, 11 Aug 2024 14:36:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id CC460484D5B for ; Sun, 11 Aug 2024 14:36:13 +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 j7zULZfpoWhj for ; Sun, 11 Aug 2024 14:36:13 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.216.44; helo=mail-pj1-f44.google.com; envelope-from=florent.m42@gmail.com; receiver= Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (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 52081484D5A for ; Sun, 11 Aug 2024 14:36:13 +0200 (CEST) Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2cf11b91813so2389300a91.1 for ; Sun, 11 Aug 2024 05:36:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723379771; x=1723984571; darn=ntg.nl; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=V9ZIRYrgRee+qV3Kldw50ya96EzBLL8QrksigPBwP2o=; b=jwSRX8kdkXCSmgwIkBFywyRam6Ugco9cG3K6RqmWT6x2hBuIiRj/6/lp18Q401jRF/ f7xBosa0jZ9S25dIryq2YRZ2TxbUKctF8kz4vxGncpvdnW33no4Lc9rL4I09a75x9OLi aaSl+0ps4x8lxjUpkd6GSAZk3YjUVWKYlZQeVxvYXRcmaA4WTUtPPhvJrtSI6vXrQYgP udAO9un/aXnmkI4E5SuRKu8cEVTgOb/0eoFPndpxaIEsIKxNUs1t93TXFuy+2uTPD+ts cZQ/leSyLoG/kS3DA0LgPph7OKbl+Te7aPOpfu7VNL5JKfn57ZhrZe9MOI6zNXHXD0lK nwUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723379771; x=1723984571; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V9ZIRYrgRee+qV3Kldw50ya96EzBLL8QrksigPBwP2o=; b=aikSdPv12nODy+3JiDrkzGgLFegtwWqNHMO6tilOjKFfpjFTjQYR7cLVpehhHha/GU anXlttXMr1dxk8mCSnYwJG16wTeBEslA0GEbvNUJ2dTu1xsrmIB3XVsScU5gD9zqND9D 25wFOVnntrVYCpqDhdMZmDNbEU51m2pQGyPM8XmmusDBG9u4TeouWOLojOSlUrW5N6zA qv1YgYQcXge/c9o8T/Gr3BU2ww4pwbpf7cP/xae9FjQBdjNpli5nSOdeyRaSZQd9yMKc vkT1+lsIWaJ3AYaFZPSrJP8fP+E6JVvT7PCumkC8IuFDWq3F6vkdD2PBoT/RDrSz/LzO rrZQ== X-Gm-Message-State: AOJu0YxK7mnScySH+m2yPeTpxETtlCaDCvNbbFR/zZnT7qPBayC3PowE msoZqXH64JeCICSjSHU6BTkZ6+GbvVRdqB6Ojnfv+FP7NUTxnLKHSYL5tPdh/k056aFUJSyXVgl XcQ6y5nTCZB8h19FokMSHczYgoH/shA== X-Google-Smtp-Source: AGHT+IEpApALEcfD+n2vsLA956DvgBzVbIMdTkJlHPOyVfEVslIv1o5fxhThA39BXf2GTlzSymRsxnmW9gm3MSJGQYk= X-Received: by 2002:a17:90b:20a:b0:2c9:cf1d:1bcc with SMTP id 98e67ed59e1d1-2d1e80688f6mr5414991a91.36.1723379770846; Sun, 11 Aug 2024 05:36:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Florent Michel Date: Sun, 11 Aug 2024 13:35:53 +0100 Message-ID: To: mailing list for ConTeXt users Message-ID-Hash: 6RNLD2IAWAG4WYPSB75S6OBDEMCLCO2T X-Message-ID-Hash: 6RNLD2IAWAG4WYPSB75S6OBDEMCLCO2T X-MailFrom: florent.m42@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.9 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: Breakable tcolorbox in ConTeXt 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="===============7591276216094648477==" --===============7591276216094648477== Content-Type: multipart/alternative; boundary="0000000000000df6d8061f679f40" --0000000000000df6d8061f679f40 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you very much Hans for your clear and detailed reply! I can confirm that this resolves my issue - and I really like the flexibility that this syntax provides! Best regards, Florent Le dim. 11 ao=C3=BBt 2024 =C3=A0 12:18, Hans Hagen via ntg-context a =C3=A9crit : > On 8/11/2024 11:24 AM, Florent Michel wrote: > > Hi, > > > > I am trying to reproduce the behaviour of the tcolorbox LaTeX package, > > more specifically breakable boxes (as illustrated here: > > https://tex.stackexchange.com/a/676607/123770 > > ). It works nicely out > of > > the box (pun intended) using `\definetextbackground` and drawing the > > frame with MetaPost, using counters to keep track of whether the curren= t > > text is at the top, middle, or bottom of the box. However, I'm having > > issues when one box ends and another starts on the same page (see more > > details below). From what I understand, the issue is that counters seem > > to be updated on a page-wide basis, so each MPgraphic =E2=80=98sees=E2= =80=99 the values > > of counters at the end of the current page, which may not be right if > > another box modifies them. Would anyone know how to resolve this? > > > > Based on two answer on TeX StackExchange > > (https://tex.stackexchange.com/a/486124/123770 > > , > > > https://tex.stackexchange.com/questions/377234/context-frame-problems/377= 261#377261 > < > https://tex.stackexchange.com/questions/377234/context-frame-problems/377= 261#377261>), > the following code works well if there is no more than one box per page: > > > > ``` > > You're missing a feature: > > this is the original trick: > > if multilocs[i] =3D=3D 1 : % begin > elseif multilocs[i] =3D=3D 2 : % between > elseif multilocs[i] =3D=3D 3 : % end > fi ; > > and in lmtx we have > > if multikind[i] =3D "single" : > elseif multikind[i] =3D "first" : > elseif multikind[i] =3D "middle" : > elseif multikind[i] =3D "last" : > > Also: > > path p; > p :=3D ( llcorner multipars[i] > -- lrcorner multipars[i] > -- urcorner multipars[i] > -- ulcorner multipars[i] > -- cycle ) > enlarged (EmWidth,EmWidth) ; > fill p withcolor boxfillcolor ; > > can be > > fill multipars[i] enlarged (EmWidth,EmWidth) ... > > Hans > > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > ----------------------------------------------------------------- > > > _________________________________________________________________________= __________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror= ) > archive : https://github.com/contextgarden/context > wiki : https://wiki.contextgarden.net > > _________________________________________________________________________= __________ > --0000000000000df6d8061f679f40 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you very much Hans for your clear and=C2=A0detailed= =C2=A0reply!=C2=A0
I can confirm that this=C2=A0resolves my=C2=A0issue -= and I really like=C2=A0the=C2=A0flexibility that this syntax provides!
=
Best regards,
Florent

Le=C2=A0dim. 11 ao=C3=BBt 2024 =C3=A0=C2=A012= :18, Hans Hagen via ntg-context <ntg-context@ntg.nl> a =C3=A9crit=C2=A0:
On 8/11/2024 11:24 AM, Flor= ent Michel wrote:
> Hi,
>
> I am trying to reproduce the behaviour of the tcolorbox LaTeX package,=
> more specifically breakable boxes (as illustrated here:
> https://tex.stackexchange.com/a/676607/123770 =
> <https://tex.stackexchange.com/a/676607/123770<= /a>>). It works nicely out of
> the box (pun intended) using `\definetextbackground` and drawing the <= br> > frame with MetaPost, using counters to keep track of whether the curre= nt
> text is at the top,=C2=A0middle, or bottom of the box. However, I'= m having
> issues when one box ends and another starts on the same page (see more=
> details below). From what I understand, the issue is that counters see= m
> to be updated on a page-wide basis,=C2=A0so each MPgraphic =E2=80=98se= es=E2=80=99 the values
> of counters at the end of the current page,=C2=A0which may not be righ= t if
> another box modifies them. Would anyone know how to resolve this?
>
> Based on two answer on TeX StackExchange
> (
https://tex.stackexchange.com/a/486124/123770=
> <https://tex.stackexchange.com/a/486124/123770<= /a>> ,
>
https://tex.= stackexchange.com/questions/377234/context-frame-problems/377261#377261= <https://tex.= stackexchange.com/questions/377234/context-frame-problems/377261#377261= >), the following code works well if there is no more than one box per p= age:
>
> ```

You're missing a feature:

this is the original trick:

if=C2=A0 =C2=A0 =C2=A0multilocs[i] =3D=3D 1 :=C2=A0 % begin
elseif multilocs[i] =3D=3D 2 :=C2=A0 % between
elseif multilocs[i] =3D=3D 3 :=C2=A0 % end
fi ;

and in lmtx we have

if=C2=A0 =C2=A0 =C2=A0 multikind[i] =3D "single" :
elseif=C2=A0 multikind[i] =3D "first"=C2=A0 :
elseif=C2=A0 multikind[i] =3D "middle" :
elseif=C2=A0 multikind[i] =3D "last"=C2=A0 =C2=A0:

Also:

=C2=A0 =C2=A0 =C2=A0 path p;
=C2=A0 =C2=A0 =C2=A0 =C2=A0p :=3D ( llcorner multipars[i]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -- lrcorner multipars[i] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -- urcorner multipars[i] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -- ulcorner multipars[i] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -- cycle )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 enlarged (EmWidth,EmWidth)= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0fill p withcolor boxfillcolor ;

can be

fill multipars[i] enlarged (EmWidth,EmWidth) ...

Hans


-----------------------------------------------------------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Hans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80= 61 GH Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 | www.pragma-ade.nl | www.= pragma-pod.nl
-----------------------------------------------------------------

___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / https://mailman.ntg.nl/mail= man3/lists/ntg-context.ntg.nl
webpage=C2=A0 : https://www.pragma-ade.nl / https://context.aanhet.net= (mirror)
archive=C2=A0 : https://github.com/contextgarden/context=
wiki=C2=A0 =C2=A0 =C2=A0: https://wiki.contextgarden.net
___________________________________________________________________________= ________
--0000000000000df6d8061f679f40-- --===============7591276216094648477== 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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________ --===============7591276216094648477==--