![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
Hi, in documentations I can find various examples of circled text. But copying them I had no success till now. I want to place text in half circles of various radiuses. Is there anywhere a simple example? My greatest problems seem to be in the embedding code. Gerhard -- Gerhard Kugler Bensheim
![](https://secure.gravatar.com/avatar/60f3cc97f94fa3690ba406f8c1a7fc4f.jpg?s=120&d=mm&r=g)
On 03/29/2018 10:28 PM, Gerhard Kugler wrote:
Hi,
in documentations I can find various examples of circled text. But copying them I had no success till now.
I want to place text in half circles of various radiuses. Is there anywhere a simple example?
The Metafun experts would probably tear this apart... \startuniqueMPgraphic{half circle} path p, q ; p := fullcircle scaled OverlayWidth; q := (p cutafter (point .5 along p)) shifted (0,-.5BodyFontSize) ; fill q -- cycle withcolor lightgray ; draw q withpen pencircle scaled 2pt withcolor darkred ; setbounds currentpicture to boundingbox p ; \stopuniqueMPgraphic \defineoverlay[half circle][\uniqueMPgraphic{half circle}] \starttext \framed[background=half circle,frame=off]{Text width half circle.} \stoptext
My greatest problems seem to be in the embedding code.
Gerhard
![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
On 3/29/2018 11:52 AM, Henri Menke wrote:
On 03/29/2018 10:28 PM, Gerhard Kugler wrote:
Hi,
in documentations I can find various examples of circled text. But copying them I had no success till now.
I want to place text in half circles of various radiuses. Is there anywhere a simple example?
The Metafun experts would probably tear this apart...
\startuniqueMPgraphic{half circle} path p, q ; p := fullcircle scaled OverlayWidth; q := (p cutafter (point .5 along p)) shifted (0,-.5BodyFontSize) ; fill q -- cycle withcolor lightgray ; draw q withpen pencircle scaled 2pt withcolor darkred ; setbounds currentpicture to boundingbox p ; \stopuniqueMPgraphic
\defineoverlay[half circle][\uniqueMPgraphic{half circle}]
\starttext
\framed[background=half circle,frame=off]{Text width half circle.}
\stoptext
Well, if you really want a tear down ... \startuniqueMPgraphic{half circle} path p ; p := halfcircle scaled OverlayWidth shifted center OverlayBox ; path q ; q := p shifted (0,-StrutDepth) ; draw image ( fill q -- cycle withcolor OverlayColor ; draw q withcolor OverlayLineColor ; ) withpen pencircle scaled 2pt ; setbounds currentpicture to boundingbox OverlayBox ; \stopuniqueMPgraphic \defineoverlay[half circle][\uniqueMPgraphic{half circle}] \starttext \framed [background=half circle, frame=off, framecolor=red, backgroundcolor=lightgray] {Text width half circle.} \framed [background=half circle, frame=off, framecolor=red, backgroundcolor=lightgray] {Text width half circle and more.} \stoptext
My greatest problems seem to be in the embedding code.
Gerhard
___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
Thank you very much for these examples. The most important hints are given now. Perhaps I am able to apply them. One misunderstanding made by my post: I want to write the text curved as a (half-)circle. Gerhard -- Gerhard Kugler Bensheim
![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
On Thu, Mar 29, 2018 at 07:11:50AM -0600, Alan Braslau wrote:
On Thu, 29 Mar 2018 12:43:56 +0200 Gerhard Kugler
wrote: One misunderstanding made by my post: I want to write the text curved as a (half-)circle.
Take a look at the Metafun manual.
In the manual is an example on page 233 with the following content: ----- \def\rotatetokens#1#2#3#4% delta extra radius tokens {\vbox\bgroup \MPtoks\emptytoks \resetMPdrawing \startMPdrawing picture pic[] ; numeric wid, len[], rot ; numeric delta, extra, radius, n, r ; len[0] := n := 0 ; delta := #1 ; extra := #2 ; radius := #3 ; \stopMPdrawing \handletokens#4\with\processrotationtoken \startMPdrawing r := len[n]/Pi ; for i=1 upto n : wid := abs(xpart lrcorner pic[i] - xpart llcorner pic[i]) ; rot := extra + delta - ((len[i]-.5wid)/len[n]) * (180+2delta) ; draw pic[i] rotatedaround (origin,-270) shifted (-r-radius, ypart -.5[ulcorner pic[i], llcorner pic[i]]) rotatedaround (origin,rot) ; endfor ; \stopMPdrawing \MPdrawingdonetrue \getMPdrawing \resetMPdrawing \egroup} \startcombination[3*1] {\rotatetokens {0} {0}{0}{Does it work ok?}} {A} {\rotatetokens{20} {0}{0}{Does it work ok?}} {B} {\rotatetokens{20}{30}{0}{Does it work ok?}} {C} \stopcombination ----- But I cannot see what part calls what parts and how they can be embedded. Gerhard -- Gerhard Kugler Bensheim
![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
Hello, my problem is that in other programming langguages there is a main procedure which calls others. In metapost in the context of ConteXt I can use \starttext ... \stoptext or \startMPpage ... \stopMPpage or \beginfig ... \endfig And it seems not to be transparent how procedures are called. Gerhard -- Gerhard Kugler Bensheim
![](https://secure.gravatar.com/avatar/6e50a7aa57f5569d881f204f124d96ef.jpg?s=120&d=mm&r=g)
Hello,
luatex includes the MetaPost library MPlib, so MetaPost code is called
and then injected into the output stream. As a user, it is useful to
know that MP is in fact called in two passes, thus twice, and this can
have some unexpected consequences when not programmed cleanly. Global
variable storage, for example, can reflect the multiple passes. Take
the following (silly) example:
\starttext
\startMPcode
if unknown n : n := 0 ; fi
n := n + 1 ;
draw textext(decimal n) ;
\stopMPcode
\startMPcode
n := n + 1 ;
draw textext(decimal n) ;
\stopMPcode
\stoptext
yielding:
1
3
(perhaps Hans or Taco can explain why one does not get 2 4)
This side effect is somewhat handled by the fact that each call to MP
is treated as a group : begingroup ... endgroup so
\startMPcode
save n ; n := 0 ;
...
\stopMPcode
works as expected, but n is then local and becomes unknown (or keeps
its global value) for subsequent calls to MP.
What should be understood is that calls to MP returns a bounding box to
TeX, and space is reserved for this bounding box. Likewise, calls
within MP to TeX, for example textext() or label(), or btex ... etex
returns a bounding box to MP, and this (picture) object is placed in
the graphic. Mechanisms exist allowing the passing of values of
variables via lua (as strings, in fact). This is a more advanced
subject.
Now, there are a number of ways of calling MP from TeX, directly as
above, but also as unique MP graphics or as reusable MP graphics, ...
This is another subject all together.
Hopefully this helps some.
Alan
On Fri, 30 Mar 2018 13:31:30 +0200
Gerhard Kugler
Hello,
my problem is that in other programming langguages there is a main procedure which calls others. In metapost in the context of ConteXt I can use \starttext ... \stoptext or \startMPpage ... \stopMPpage or \beginfig ... \endfig
And it seems not to be transparent how procedures are called.
Gerhard
![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
Thank you, this seems a very informative explanation for me, and now I will try to transpose it for my intention. Gerhard On Fri, Mar 30, 2018 at 08:44:23AM -0600, Alan Braslau wrote:
Hello,
luatex includes the MetaPost library MPlib, so MetaPost code is called and then injected into the output stream...
-- Gerhard Kugler Bensheim
![](https://secure.gravatar.com/avatar/60f3cc97f94fa3690ba406f8c1a7fc4f.jpg?s=120&d=mm&r=g)
On Thu, 2018-03-29 at 18:05 +0200, Gerhard Kugler wrote:
On Thu, Mar 29, 2018 at 07:11:50AM -0600, Alan Braslau wrote:
On Thu, 29 Mar 2018 12:43:56 +0200 Gerhard Kugler
wrote: One misunderstanding made by my post: I want to write the text curved as a (half-)circle.
Take a look at the Metafun manual.
In the manual is an example on page 233 with the following content:
Nah! Don't use those macros. They are only for demonstration. Use the builtin \followtokens instead: \loadmarkfile{meta-imp-txt} % is this supposed to be loaded like that? \starttext \startuseMPgraphic{followtokens} path RotPath ; RotPath := reverse halfcircle ; \stopuseMPgraphic \followtokens{Text on a half circle} \stoptext
-----
\def\rotatetokens#1#2#3#4% delta extra radius tokens {\vbox\bgroup \MPtoks\emptytoks \resetMPdrawing \startMPdrawing picture pic[] ; numeric wid, len[], rot ; numeric delta, extra, radius, n, r ; len[0] := n := 0 ; delta := #1 ; extra := #2 ; radius := #3 ; \stopMPdrawing \handletokens#4\with\processrotationtoken \startMPdrawing r := len[n]/Pi ; for i=1 upto n : wid := abs(xpart lrcorner pic[i] - xpart llcorner pic[i]) ; rot := extra + delta - ((len[i]-.5wid)/len[n]) * (180+2delta) ; draw pic[i] rotatedaround (origin,-270) shifted (-r-radius, ypart -.5[ulcorner pic[i], llcorner pic[i]]) rotatedaround (origin,rot) ; endfor ; \stopMPdrawing \MPdrawingdonetrue \getMPdrawing \resetMPdrawing \egroup}
\startcombination[3*1] {\rotatetokens {0} {0}{0}{Does it work ok?}} {A} {\rotatetokens{20} {0}{0}{Does it work ok?}} {B} {\rotatetokens{20}{30}{0}{Does it work ok?}} {C} \stopcombination
-----
But I cannot see what part calls what parts and how they can be embedded.
Gerhard
![](https://secure.gravatar.com/avatar/60f3cc97f94fa3690ba406f8c1a7fc4f.jpg?s=120&d=mm&r=g)
On Sat, 2018-03-31 at 12:22 +1300, Henri Menke wrote:
On Thu, 2018-03-29 at 18:05 +0200, Gerhard Kugler wrote:
On Thu, Mar 29, 2018 at 07:11:50AM -0600, Alan Braslau wrote:
On Thu, 29 Mar 2018 12:43:56 +0200 Gerhard Kugler
wrote: One misunderstanding made by my post: I want to write the text curved as a (half-)circle.
Take a look at the Metafun manual.
In the manual is an example on page 233 with the following content:
Nah! Don't use those macros. They are only for demonstration. Use the builtin \followtokens instead:
\loadmarkfile{meta-imp-txt} % is this supposed to be loaded like that?
\loadmarkfile{meta-imp-txt} is the wrong way. It's supposed to be \useMPlibrary[txt]
\starttext
\startuseMPgraphic{followtokens} path RotPath ; RotPath := reverse halfcircle ; \stopuseMPgraphic \followtokens{Text on a half circle}
\stoptext
-----
\def\rotatetokens#1#2#3#4% delta extra radius tokens {\vbox\bgroup \MPtoks\emptytoks \resetMPdrawing \startMPdrawing picture pic[] ; numeric wid, len[], rot ; numeric delta, extra, radius, n, r ; len[0] := n := 0 ; delta := #1 ; extra := #2 ; radius := #3 ; \stopMPdrawing \handletokens#4\with\processrotationtoken \startMPdrawing r := len[n]/Pi ; for i=1 upto n : wid := abs(xpart lrcorner pic[i] - xpart llcorner pic[i]) ; rot := extra + delta - ((len[i]-.5wid)/len[n]) * (180+2delta) ; draw pic[i] rotatedaround (origin,-270) shifted (-r-radius, ypart -.5[ulcorner pic[i], llcorner pic[i]]) rotatedaround (origin,rot) ; endfor ; \stopMPdrawing \MPdrawingdonetrue \getMPdrawing \resetMPdrawing \egroup}
\startcombination[3*1] {\rotatetokens {0} {0}{0}{Does it work ok?}} {A} {\rotatetokens{20} {0}{0}{Does it work ok?}} {B} {\rotatetokens{20}{30}{0}{Does it work ok?}} {C} \stopcombination
-----
But I cannot see what part calls what parts and how they can be embedded.
Gerhard
![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
Hi, my very slow proceedings are here: -------- \useMPlibrary[txt] \starttext \setupbodyfont[pp1] \setupcolors[state=start] \setuplayout [topspace=192pt, backspace=48pt, cutspace=12pt, width=400pt, margin=0cm, rightedge=88pt, rightedgedistance=48pt, header=0cm, footer=0cm, height=400pt] \startuseMPgraphic{followtokens} path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ; \stopuseMPgraphic \followtokens{Dies ist ein anderer Text} \startuseMPgraphic{followtokens} path RotPath ; RotPath := halfcircle scaled 14cm rotated 180 ; \stopuseMPgraphic \followtokens{Dies ist ein selbst geschriebener Text} -------- But I want to place the round lines concentrically in a circle (more than two). And I want to place all the lines on colored circled background. In the nice children programming language "logo" it is easy, but yealds pixle grapics only. Gerhard -- Gerhard Kugler Bensheim
![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
On 3/31/2018 7:22 PM, Gerhard Kugler wrote:
Hi,
my very slow proceedings are here:
--------
\useMPlibrary[txt]
\starttext
\setupbodyfont[pp1]
\setupcolors[state=start]
\setuplayout [topspace=192pt, backspace=48pt, cutspace=12pt, width=400pt, margin=0cm, rightedge=88pt, rightedgedistance=48pt, header=0cm, footer=0cm, height=400pt]
\startuseMPgraphic{followtokens} path RotPath ;
RotPath := halfcircle scaled 7cm rotated 180 ;
\stopuseMPgraphic
\followtokens{Dies ist ein anderer Text}
\startuseMPgraphic{followtokens} path RotPath ;
RotPath := halfcircle scaled 14cm rotated 180 ;
\stopuseMPgraphic
\followtokens{Dies ist ein selbst geschriebener Text}
--------
But I want to place the round lines concentrically in a circle (more than two). And I want to place all the lines on colored circled background. \useMPlibrary[txt]
\starttext \startuseMPgraphic{followtokens} path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ; for i=1 upto 6 : draw halfcircle scaled (i*cm) rotated 180 ; endfor ; \stopuseMPgraphic \followtokens{Dies ist ein anderer Text} \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/6e50a7aa57f5569d881f204f124d96ef.jpg?s=120&d=mm&r=g)
On Mon, 2 Apr 2018 15:16:11 +0200
Hans Hagen
\useMPlibrary[txt]
\starttext
\startuseMPgraphic{followtokens} path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ; for i=1 upto 6 : draw halfcircle scaled (i*cm) rotated 180 ; endfor ; \stopuseMPgraphic
\followtokens{Dies ist ein anderer Text}
\stoptext
or, perhaps (a question of taste): for i=1 upto 6 : draw RotPath scaled (i/7) ; endfor ; Alan
![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
Thank you very much! And if I want to place different text between the (half-)circles? Gerhard On Mon, Apr 02, 2018 at 03:16:11PM +0200, Hans Hagen wrote:
\useMPlibrary[txt]
\starttext
\startuseMPgraphic{followtokens} path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ; for i=1 upto 6 : draw halfcircle scaled (i*cm) rotated 180 ; endfor ; \stopuseMPgraphic
\followtokens{Dies ist ein anderer Text}
\stoptext
-- Gerhard Kugler Bensheim
![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
On 4/2/2018 5:52 PM, Gerhard Kugler wrote:
Thank you very much!
And if I want to place different text between the (half-)circles?
\startuseMPgraphic{followtokens-1} path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ; for i=1 upto 6 : draw halfcircle scaled (i*cm) rotated 180 ; endfor ; setbounds currentpicture to boundingbox halfcircle scaled 7cm rotated 180 ; \stopuseMPgraphic \startuseMPgraphic{followtokens-2} path RotPath ; RotPath := halfcircle scaled 6cm rotated 180 ; setbounds currentpicture to boundingbox halfcircle scaled 7cm rotated 180 ; \stopuseMPgraphic \startoverlay {\startuseMPgraphic{followtokens}\includeMPgraphic{followtokens-1}\stopuseMPgraphic \followtokens{\strut Dies ist ein anderer Text\strut}} {\startuseMPgraphic{followtokens}\includeMPgraphic{followtokens-2}\stopuseMPgraphic \followtokens{\strut Less text than before\strut}} \stopoverlay
On Mon, Apr 02, 2018 at 03:16:11PM +0200, Hans Hagen wrote:
\useMPlibrary[txt]
\starttext
\startuseMPgraphic{followtokens} path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ; for i=1 upto 6 : draw halfcircle scaled (i*cm) rotated 180 ; endfor ; \stopuseMPgraphic
\followtokens{Dies ist ein anderer Text}
\stoptext
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
Finally I want to place 8 (halfcircled) texts within 8 colores (full)rings. Your proposal places the second text outside of the circles. Gerhard On Mon, Apr 02, 2018 at 06:08:56PM +0200, Hans Hagen wrote:
On 4/2/2018 5:52 PM, Gerhard Kugler wrote:
Thank you very much!
And if I want to place different text between the (half-)circles?
\startuseMPgraphic{followtokens-1} path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ; for i=1 upto 6 : draw halfcircle scaled (i*cm) rotated 180 ; endfor ; setbounds currentpicture to boundingbox halfcircle scaled 7cm rotated 180 ; \stopuseMPgraphic
\startuseMPgraphic{followtokens-2} path RotPath ; RotPath := halfcircle scaled 6cm rotated 180 ; setbounds currentpicture to boundingbox halfcircle scaled 7cm rotated 180 ; \stopuseMPgraphic
\startoverlay
{\startuseMPgraphic{followtokens}\includeMPgraphic{followtokens-1}\stopuseMPgraphic \followtokens{\strut Dies ist ein anderer Text\strut}}
{\startuseMPgraphic{followtokens}\includeMPgraphic{followtokens-2}\stopuseMPgraphic \followtokens{\strut Less text than before\strut}} \stopoverlay
On Mon, Apr 02, 2018 at 03:16:11PM +0200, Hans Hagen wrote:
\useMPlibrary[txt]
\starttext
\startuseMPgraphic{followtokens} path RotPath ; RotPath := halfcircle scaled 7cm rotated 180 ; for i=1 upto 6 : draw halfcircle scaled (i*cm) rotated 180 ; endfor ; \stopuseMPgraphic
\followtokens{Dies ist ein anderer Text}
\stoptext
--
----------------------------------------------------------------- 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 ___________________________________________________________________________________
-- Gerhard Kugler Bensheim
![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
Perhaps it is better if I send the final graphic which I have prorammed with the programming langguage "logo". See attachment! The problem: it is pixel graphic. Gerhard On Mon, Apr 02, 2018 at 06:34:42PM +0200, Gerhard Kugler wrote:
Finally I want to place 8 (halfcircled) texts within 8 colores (full)rings. Your proposal places the second text outside of the circles.
-- Gerhard Kugler Bensheim
![](https://secure.gravatar.com/avatar/6e50a7aa57f5569d881f204f124d96ef.jpg?s=120&d=mm&r=g)
This is very easy to do in MetaPost, but you should not expect the
mailing list to design your graphic for you.
Alan
On Mon, 2 Apr 2018 19:21:05 +0200
Gerhard Kugler
Perhaps it is better if I send the final graphic which I have prorammed with the programming langguage "logo". See attachment!
The problem: it is pixel graphic.
Gerhard
On Mon, Apr 02, 2018 at 06:34:42PM +0200, Gerhard Kugler wrote:
Finally I want to place 8 (halfcircled) texts within 8 colores (full)rings. Your proposal places the second text outside of the circles.
![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
On Mon, Apr 02, 2018 at 11:30:05AM -0600, Alan Braslau wrote:
This is very easy to do in MetaPost, but you should not expect the mailing list to design your graphic for you.
You are right totally. It is not my expectation. I succeeded in programming several graphics in metapost in the past. But in the present I am a blockhead. Gerhard -- Gerhard Kugler Bensheim
![](https://secure.gravatar.com/avatar/2a8ad19ccee878ccefda1ed6797ea57e.jpg?s=120&d=mm&r=g)
One question: How can I give the several half circle text lines the same origin (that of the circles)? Gerhard -- Gerhard Kugler Bensheim
participants (4)
-
Alan Braslau
-
Gerhard Kugler
-
Hans Hagen
-
Henri Menke