ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Pull quote between two column - trial
@ 2022-05-21 21:20 Garulfo via ntg-context
  2022-05-28 18:25 ` Garulfo via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Garulfo via ntg-context @ 2022-05-21 21:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Garulfo

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

Hi all,

hope you are all doing well.

I am still trying to display pull quote between two columns.

lmt_parshape is really helpfull.


I need to add a 1pt gap to make the left column behave correctly,
but the right column remains shifted one line below the intended one.

Question1: any clue ?

Question2: is there a way to use the columnset system to produce a 
similar output ?

Thanks again for your feedbacks,
Garulfo

[-- Attachment #2: pullquote_between_column_v01.tex --]
[-- Type: text/x-tex, Size: 4061 bytes --]


\setuplayout
  [grid=yes,
   headerdistance=5mm,
   margindistance=5mm,
   backspace=17.5mm,
   margin=10mm,
   topspace=40mm,
   height=23cm,
   header=10mm,
   footer=10mm,
   width=17.5cm]

%\showframe
%\showgrid
\usemodule     [visual]

\setupbodyfont [palatino,11pt]

\definecolor [transparentred]  [r=1,t=.5,a=1]
\definecolor [transparentgreen][g=1,t=.5,a=1]

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

\def\posA{10}
\def\posB{20}
\def\mygap{1pt}
\def\mypen{1pt}
\def\PQhalfwith{20mm}

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

\startuseMPgraphic{mytest0}   % for basic straight column
    begingroup ;
    save p ; path p ;
    p := (0,0)  --
         (0.3*TextWidth,0cm) --
         (0.3*TextWidth,TextHeight) --
         (0cm,TextHeight) --cycle  ;
    lmt_parshape [path = p] ;
    draw p withpen pencircle scaled \mypen ;
    endgroup ;
\stopuseMPgraphic

\startuseMPgraphic{mytest1}  % column on the left of the pull quote
    begingroup ;
    save p ; path p ;
    p := (0,0)  --
         (0.3*TextWidth,0cm) --
         (0.3*TextWidth,            TextHeight+\mygap-\posB*LineHeight) --
         (0.3*TextWidth-\PQhalfwith,TextHeight+\mygap-\posB*LineHeight) --
         (0.3*TextWidth-\PQhalfwith,TextHeight-\mygap-\posA*LineHeight) --
         (0.3*TextWidth,            TextHeight-\mygap-\posA*LineHeight) --
         (0.3*TextWidth,TextHeight) --
         (0cm,TextHeight) --cycle  ;
    lmt_parshape [path = p] ;
    draw p withpen pencircle scaled \mypen ;
    endgroup ;
\stopuseMPgraphic

\startuseMPgraphic{mytest2}   % column on the right of the pull quote
    begingroup ;
    save p ; path p ;
    p := (0,0)  --
         (0.3*TextWidth,0cm) --
         (0.3*TextWidth,TextHeight) --
         (0cm,TextHeight) --
         (0.0*TextWidth,            TextHeight-\mygap-\posA*LineHeight) --
         (0.0*TextWidth+\PQhalfwith,TextHeight-\mygap-\posA*LineHeight) --
         (0.0*TextWidth+\PQhalfwith,TextHeight+\mygap-\posB*LineHeight) --
         (0.0*TextWidth,            TextHeight+\mygap-\posB*LineHeight) --
         cycle  ;
    lmt_parshape [path = p] ;
    draw p withpen pencircle scaled \mypen ;
    endgroup ;
\stopuseMPgraphic

\defineoverlay[myOL1][\useMPgraphic{mytest1}]
\defineoverlay[myOL2][\useMPgraphic{mytest2}]

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

\defineframed
  [FramePage]
  [align=width,
   frame=off,
   location=high,
   strut=yes,
   offset=0pt,
   width=\textwidth,
   height=\textheight,
   before=]

\defineframed
  [FrameColumn]
  [FramePage]
  [background=color,
   backgroundcolor=transparentred,
   width=0.3\textwidth,
   after=\dontleavehmode]

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

\definelayer     % used to display the pull quote on the page
  [test]
  [x=0mm,
   y=0mm,
   width=\paperwidth,
   height=\paperheight]

%=======================================================

\starttext

\startshapetext[mytest1,mytest2,mytest0,mytest0]%
\strut%
\dorecurse{3}{\samplefile{douglas}
\blank[1*line]}%
\stopshapetext

%------------------------------------------------------------
% First page

\FramePage{%
\FrameColumn[background={color,myOL1}]{\getshapetext}\hfill
\FrameColumn[background={color,myOL2}]{\getshapetext}\hfill
\FrameColumn{empty}}


% and the pull quote

\setlayer
  [test]
  [hoffset=\backspace+0.3\textwidth-\PQhalfwith+0.2pt,
   voffset=\dimexpr(\topspace+\headerheight+\headerdistance+\posA\baselineskip-0.4pt)]
 {\framed[
    background=color,
    backgroundcolor=transparentgreen,
    frame=off,
    strut=yes,
    offset=0pt,
    width=\dimexpr(0.05\textwidth)+\PQhalfwith+\PQhalfwith,
    height=\dimexpr(\posB\baselineskip-\posA\baselineskip)]{\bfd PULL QUOTE\\TRIAL}}

\setupbackgrounds[page][background={foreground,test}]

%------------------------------------------------------------
% Second page just to demonstrate that \getshapetext continue to work

\page

\FramePage{%
\FrameColumn{\getshapetext}\hfill
\FrameColumn{\getshapetext}\hfill
\FrameColumn{empty}}


\stoptext


[-- Attachment #3: pullquote_between_column_v01.pdf --]
[-- Type: application/pdf, Size: 17425 bytes --]

[-- 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pull quote between two column - trial
  2022-05-21 21:20 Pull quote between two column - trial 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
  0 siblings, 2 replies; 4+ messages in thread
From: Garulfo via ntg-context @ 2022-05-28 18:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Garulfo

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

some progress... if it can help.

No more issue with nonsymetrical behavior, and \framed are properly 
aligned with the grid.

Garulfo

[-- Attachment #2: getshapetext_for_pullquote.pdf --]
[-- Type: application/pdf, Size: 19939 bytes --]

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

\setuplayout [grid=yes]

\showgrid

\definecolor [transparentred]  [r=1,t=.5,a=1]

\def\numA{18}
\def\numB{4}
\def\numC{8}
\def\numD{14}
\def\mygap{0.001pt}

%=======================================================

\startMPinclusions
    path pleft ; path pright ;

    numeric LA ; LA := (\numA-1)*LineHeight + StrutHeight + StrutDepth + \mygap ;
    numeric LB ; LB :=  \numB   *LineHeight - StrutHeight - StrutDepth + \mygap ;
    numeric LC ; LC :=  \numC   *LineHeight - StrutHeight - StrutDepth - \mygap ;
    numeric LD ; LD :=  \numD   *LineHeight ;
    numeric LE ; LE := 2cm ;

    pleft := (0cm     , 0cm    ) --
             (LD      , 0cm    ) --
             (LD      , LA - LC) --
             (LD - LE , LA - LC) --
             (LD - LE , LA - LB) --
             (LD      , LA - LB) --
             (LD      , LA     ) --
             (0cm     , LA     ) --
             cycle  ;

    pright := pleft reflectedabout ((LD/2,0cm) , (LD/2,1cm));

\stopMPinclusions

\startuseMPgraphic{mytest1}  % column on the left of the pull quote
    lmt_parshape [path = pleft ] ;
    fill pleft withcolor \MPcolor{transparentred} ;
\stopuseMPgraphic

\startuseMPgraphic{mytest2}  % column on the right of the pull quote
    lmt_parshape [path = pright] ;
    fill pright withcolor \MPcolor{transparentred} ;
\stopuseMPgraphic

\defineoverlay[myOL1][\useMPgraphic{mytest1}]
\defineoverlay[myOL2][\useMPgraphic{mytest2}]

%=======================================================

\defineframed
  [MyBigFrame]
  [offset=-0.26pt,
   frameoffset=0pt,
   frame=off,
   strut=yes,
   before=,
   location=top,
   height=\dimexpr(\numA\lineheight),
   width=\textwidth,
   align=normal,]

\defineframed
  [MyFrame]
  [MyBigFrame]
  [location=high,
   width=\dimexpr(\numD\lineheight),
   after=\dontleavehmode,]

%=======================================================

\starttext

{\bf Before}   %----------------------------------------

\startshapetext[mytest1,mytest2]
\strut\samplefile{douglas}
\stopshapetext

\MyBigFrame{%
\MyFrame[background=myOL1]{\getshapetext}%
\hfill%
\MyFrame[background=myOL2]{\getshapetext}}

{\bf Between}  %----------------------------------------

\startshapetext[mytest1,mytest2]
\strut\samplefile{knuth}\par\samplefile{knuth}
\stopshapetext

\MyBigFrame{%
\MyFrame[background=myOL1]{\getshapetext}%
\hfill%
\MyFrame[background=myOL2]{\getshapetext}}

{\bf After}    %----------------------------------------

\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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pull quote between two column - trial
  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
  1 sibling, 0 replies; 4+ messages in thread
From: jbf via ntg-context @ 2022-05-28 22:55 UTC (permalink / raw)
  To: Garulfo via ntg-context; +Cc: jbf, mailing list for ConTeXt users

That is progress, Garulfo, and real progress! I'm sorry I have not been 
any help to you in achieving this... a bit beyond my skill set. But I 
have long regarded this particular 'feature' to be a quite important 
'missing' feature of ConTeXt, since I occasionally get requests from 
authors as to the possibility of including such pull quotes in 
multi-column presentations, and I have to tell them that to do so I need 
to use another program where that is more easily achieved.

So, I just wanted you to know that someone out there appreciates your 
efforts with this, one of many I am sure.

Julian

On 29/5/22 04:25, Garulfo via ntg-context wrote:
> some progress... if it can help.
>
> No more issue with nonsymetrical behavior, and \framed are properly 
> aligned with the grid.
>
> Garulfo
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pull quote between two column - trial
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Garulfo via ntg-context @ 2022-05-29 17:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Garulfo

[-- 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-29 17:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-21 21:20 Pull quote between two column - trial 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 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).