ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Otared Kavian <otared@gmail.com>
Subject: Re: lmtx update / teaser
Date: Mon, 1 Mar 2021 19:13:36 +0100	[thread overview]
Message-ID: <c5d7be1d-e590-e865-e7f5-dce57aea1fc5@xs4all.nl> (raw)
In-Reply-To: <7E03411D-ADBA-4B2A-B202-C9DEEDAC8843@gmail.com>

On 3/1/2021 6:27 PM, Otared Kavian wrote:
> Hi Hans,
> 
> Thank you for the new upload.
> 
> The teaser examples work fine, many thanks !
> I have a question though: how can one center within a page a text, for example typeset in a circular shape? I tried with \startalignment, and also with \startplacefigure but none of these gives a centered circular shape.
> 
> Also I noticed that if one removes the comment at the end of \startshapedparagraph, or add a blank line after that, then the circular shape is destroyed: is this on purpose ?
\starttext

\startuseMPgraphic{circleBis}
     lmt_parshape [
         path       = fullcircle scaled 90mm,
         offset     = 2mm,
         bottomskip = - 1.5LineHeight,
     ] ;
\stopuseMPgraphic

\startplacefigure[align=middle,number=no]
     \framed[width=90mm,offset=2mm,align=normal]\bgroup
         \startshapedparagraph
             [list=circle,mp=circleBis,repeat=yes,method=repeat]%
             \setupalign[verytolerant,stretch,last]\dontcomplain
             {\darkred \samplefile{thuan}}
         \stopshapedparagraph
     \egroup
\stopplacefigure

\stoptext

We're talking parshapes here, think of

\parshape 2
   2mm 10cm
   4mm 12cm

or

\parshape 2
   options 1 % force a repeat
   2mm 10cm
   4mm 12cm

but then nicely wrapped in a macro. The circle is (cf metafun manual) 
converted into such a parshape. A parshape is forgotten when a new 
paragraph is started, but ... we have extra magic that revives them 
which is why the multi-page-par examples work too. The cycle and repeat 
methods do that (using abit diufferent tricks than the 20 year old one 
but not that different); these methods are independent of the parshape's 
repeat option itself, which is an engine feature.

Messing with left/right 'align' will also bring left/rightskip into the 
game so normally you will not do that. I admit it take a bit of 
imagination to get the picture. The 'last' keyword is some old context 
feature that centers the last line (which looks nicer in a circle) which
is using some parfillskip magic.

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

  reply	other threads:[~2021-03-01 18:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 14:44 Hans Hagen
2021-03-01 17:27 ` Otared Kavian
2021-03-01 18:13   ` Hans Hagen [this message]
2021-03-02 10:15 ` mf
2021-03-02 10:33   ` Hans Hagen
2021-03-02 10:47   ` Hans Hagen

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=c5d7be1d-e590-e865-e7f5-dce57aea1fc5@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    --cc=otared@gmail.com \
    /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).