ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Garulfo via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Garulfo <garulfo@azules.eu>
Subject: Re: Pull quote between two column - trial
Date: Sun, 29 May 2022 19:39:43 +0200	[thread overview]
Message-ID: <8b7042ee-7145-6690-2827-23db790ae768@azules.eu> (raw)
In-Reply-To: <1135a9fb-84b5-dadf-3ebb-86ef528f662e@azules.eu>

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

to use pull quotes, I need to use the dimensions of the different 
elements to be typeset, before typesetting, in order to adapt the shapes 
of the flow accordingly.

So here is just a basic code to
1/ get the dimensions of an item A that will be typeset, before it is 
actually typeset
2/ use these dimensions to define a item B that should be typeset before 
item 1
3/ typeset of item B and finally item A


It is a quick and dirty solution.

Please, could you help me to have a more elegant solution

1/ to replace

          "width=\measure{FTitleW},"

     by something more direct like

          "width=\GetDim{myframes}{FTitle}


2/ to replace

    context("\\definemeasure[#2W][" .. (n.width /65536)  .. "pt]")

    by a more "luametatexish" formulation



Le 28/05/2022 à 20:25, Garulfo a écrit :
> some progress... if it can help.
> 
> No more issue with nonsymetrical behavior, and \framed are properly 
> aligned with the grid.
> 
> Garulfo

[-- Attachment #2: mesure_framed.pdf --]
[-- Type: application/pdf, Size: 7790 bytes --]

[-- Attachment #3: mesure_framed.tex --]
[-- Type: text/x-tex, Size: 930 bytes --]


\defineblock[myframes]

\unexpanded\def\GetDim#1#2{
\setbox\scratchbox\hbox\bgroup\useblocks[#1][#2]\egroup%
\directlua{%
local n = tex.getbox('scratchbox')
context("\\definemeasure[#2W][" .. (n.width /65536)  .. "pt]")
context("\\definemeasure[#2H][" .. (n.height /65536)  .. "pt]")
}}


%------------------------------------------------------------------------------

\starttext

\beginmyframes[FTitle]
\framed
  [align=normal]
  {initial framed for a title zone\\
   early in the source code but not yet typeset\\
   with a long sentence to take place horizontaly and for demonstration}
\endmyframes

\GetDim{myframes}{FTitle}

\framed
  [align=normal,
   width=\measure{FTitleW},
   height=\measure{FTitleH}]
  {a second framed, with dimensions equal to the original frame, typeset before the original}

\useblocks[myframes][FTitle]

\stoptext

%------------------------------------------------------------------------------

[-- Attachment #4: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      parent reply	other threads:[~2022-05-29 17:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-21 21:20 Garulfo via ntg-context
2022-05-28 18:25 ` Garulfo via ntg-context
2022-05-28 22:55   ` jbf via ntg-context
2022-05-29 17:39   ` Garulfo via ntg-context [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b7042ee-7145-6690-2827-23db790ae768@azules.eu \
    --to=ntg-context@ntg.nl \
    --cc=garulfo@azules.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).