I think you may need to add the suffix to the label command. Eg. label.top (btex Gr etex, pos) rotated theta scaled sc aligned al
Sorry, I can’t test it as I don’t have Therion installed. Sent from my iPhone > On 31 May 2018, at 10:20 AM, therion-requ...@speleo.sk wrote: > > Send Therion mailing list submissions to > therion@speleo.sk > > To subscribe or unsubscribe via the World Wide Web, visit > https://mailman.speleo.sk/listinfo/therion > or, via email, send a message with subject or body 'help' to > therion-requ...@speleo.sk > > You can reach the person managing the list at > therion-ow...@speleo.sk > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Therion digest..." > > > Today's Topics: > > 1. Re: Defining a user symbol that contains a short text string, > Therion Digest, Vol 149, Issue 34 (Dave Clucas) > 2. Defining a user symbol that contains a short text string > (Bruce Mutton) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 30 May 2018 16:04:32 +0100 > From: Dave Clucas <dave.clu...@icloud.com> > To: therion@speleo.sk > Cc: Dave Clucas MY <dave.clu...@icloud.com> > Subject: Re: [Therion] Defining a user symbol that contains a short > text string, Therion Digest, Vol 149, Issue 34 > Message-ID: <5aca36e2-6146-4525-8f3a-ec0cea639...@icloud.com> > Content-Type: text/plain; charset="utf-8" > > Bruce, read this > > 3.6 Text > > You have already seen how the dotlabel command can be used to draw a dot and > a label in the neighborhood of the dot. If you do not want the dot, simply > use the label command: > > label.suffix(string expression, pair); > > It uses of the same suffices as the dotlabel command to position the label > relative to the given pair. No suffix means that the label is printed at the > specified location. The directives rt (right), urt (upper right), top (top), > ulft (upper left), lft (left), llft (lower left), bot (bottom), lrt (lower > right) can be used to specify the relative position of the label to the given > pair. The distance from the pair to the label is set by the numeric variable > labeloffset. > > The commands label and dotlabel both use a string expression for the label > text and typeset it in the default font, which is likely to be "cmr10" and > which can changed through the variables defaultfont and defaultscale. For > example, > > defaultfont := "tir"; > defaultscale := 12pt/fontsize(defaultfont); > makes labels come out as Adobe Times-Roman at about 12 points. > > Until now the string expression in a text command has only been a string > delimited by double quotes (optionally joined to another string via the > concatenation operator &). But you can also bracket the text with btex and > etex (do not put it in quotes this time) and pass it to TEX for typesetting. > This allows you to use METAPOST in combination with TEX for building complex > labels. Let us begin with a simple example: > > beginfig(1); > z0 = (0,0); z1 = (sqrt(3)*cm,0); > z2 = (sqrt(3)*cm,1cm); > draw z0--z1--z2--cycle; > label.bot(btex $\sqrt{3}$ etex, 1/2[z0,z1]); > label.rt(btex 1 etex, 1/2[z1,z2]); > label.top(btex 2 etex, 1/2[z0,z2]); > endfig; > end; > > Dave Clucas > dave.clu...@icloud.com <mailto:daveclu...@icloud.com> > > Exploring the World - One cave at a time > > >> On 30 May 2018, at 11:00, therion-requ...@speleo.sk wrote: >> >> Send Therion mailing list submissions to >> therion@speleo.sk >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://mailman.speleo.sk/listinfo/therion >> or, via email, send a message with subject or body 'help' to >> therion-requ...@speleo.sk >> >> You can reach the person managing the list at >> therion-ow...@speleo.sk >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of Therion digest..." >> >> >> Today's Topics: >> >> 1. Defining a user symbol that contains a short text string >> (Bruce Mutton) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Tue, 29 May 2018 22:14:55 +1200 >> From: "Bruce Mutton" <br...@tomo.co.nz> >> To: "'List for Therion users'" <therion@speleo.sk> >> Subject: [Therion] Defining a user symbol that contains a short text >> string >> Message-ID: <000401d3f735$e5d86d90$b18948b0$@tomo.co.nz> >> Content-Type: text/plain; charset="utf-8" >> >> Good evening >> >> I'd like to make a user defined symbol that is simply an ascii text string. >> A quick and dirty adhoc symbol if you like. If I was going to be fancy, I >> would add a box around it like in the example of Dave Clucas that I have >> copied and modified below. >> >> >> >> So rather than defining the shape of the omega symbol using metapost, I'd >> like to hard code an ascii character, say "E". >> >> The yellow shaded text below needs to be replaced with some simple metapost, >> but I am too lazy to research and trial things. >> >> I notice that other examples tend to use a copy of the p_label definition, >> and modify that. I would rather not head down that route, as then my custom >> code would overwrite potential future improvements to Therion's source code. >> >> >> >> >> My plan is not really to create an alternative to the entrance symbol, but >> rather to create a template quick and dirty creation of single use or >> unusual symbols, that can be enumerated in the legend. >> >> >> >> Does anyone happen to know how to modify the code below to do what I >> describe? >> >> >> >> Thanks >> >> Bruce >> >> >> >> >> <https://therion.speleo.sk/wiki/_detail/metapost:entrancesymbol.png?id=metap >> ost> >> >> code metapost >> >> def p_u_ent (expr pos,theta,sc,al)= >> >> U:=(.2u,.5u); >> >> T:=identity aligned al rotated theta scaled sc shifted pos; >> >> path p; >> >> p = (-.3u,-.25u) -- (-.2u,-.25u){dir 135} .. (0u, .25u) .. {dir >> 225}(.2u,-.25u) -- (.3u,-.25u); % define omega shape >> >> thdraw p withpen PenA; % draw it with fat pen >> >> thdraw unitsquare scaled u shifted (-0.5u,-0.5u) rotated 45 withpen PenD; >> % diagonal box with thin pen >> >> enddef; >> >> >> >> initsymbol("p_u_ent") >> >> def p_u_ent_legend = >> p_u_ent( <I forget where to find code for point drawing in the >> legend> ) >> enddef; >> endcode >> text en "point u:ent" "E for entrance" #text to appear in legend >> >> >> >> >> >> >> >> >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> <http://mailman.speleo.sk/pipermail/therion/attachments/20180529/7d16045b/attachment-0001.html> >> -------------- next part -------------- >> A non-text attachment was scrubbed... >> Name: image001.png >> Type: image/png >> Size: 8640 bytes >> Desc: not available >> URL: >> <http://mailman.speleo.sk/pipermail/therion/attachments/20180529/7d16045b/attachment-0001.png> >> >> ------------------------------ >> >> Subject: Digest Footer >> >> _______________________________________________ >> Therion mailing list >> Therion@speleo.sk >> https://mailman.speleo.sk/listinfo/therion >> >> >> ------------------------------ >> >> End of Therion Digest, Vol 149, Issue 34 >> **************************************** > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > <http://mailman.speleo.sk/pipermail/therion/attachments/20180530/07703746/attachment-0001.html> > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: page21image655462592.png > Type: image/png > Size: 110 bytes > Desc: not available > URL: > <http://mailman.speleo.sk/pipermail/therion/attachments/20180530/07703746/attachment-0002.png> > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: page21image655462928.png > Type: image/png > Size: 126 bytes > Desc: not available > URL: > <http://mailman.speleo.sk/pipermail/therion/attachments/20180530/07703746/attachment-0003.png> > > ------------------------------ > > Message: 2 > Date: Thu, 31 May 2018 21:20:23 +1200 > From: "Bruce Mutton" <br...@tomo.co.nz> > To: "'List for Therion users'" <therion@speleo.sk> > Subject: [Therion] Defining a user symbol that contains a short text > string > Message-ID: <000001d3f8c0$9c8b4ae0$d5a1e0a0$@tomo.co.nz> > Content-Type: text/plain; charset="utf-8" > > Thanks to Dave I did a little reading, and have come up with a partial > solution. > > > > In the screenshot below, the top line shows that . > > point 0 0 u:graffiti -align b (or centre or t) > > works correctly. > > The second line shows that -scale xs, s, l and xl work OK for the circle and > box, but not the label. > > Similar for -orientation (rotation) on the third line. > > > > For some reason the centre of the scale and rotation transformation is in > the wrong place for the label. There is something I am doing wrong with the > label part of the symbol definition. Any ideas? > > > > > > > > My code so far looks like. > > code metapost > > def p_u_graffiti (expr pos,theta,sc,al)= > > U:=(.2u,.5u); > > T:=identity aligned al rotated theta scaled sc shifted pos; > > > > %# pos and al work fine in label below, but theta and sc transformed about > far off point??? > > label (btex Gr etex, pos) rotated theta scaled sc aligned al; % btex and > etex are wrappers around code to be process by tex > > > > thdraw unitsquare scaled u shifted (-0.5u,-0.5u) rotated 45 withpen PenD; > % diagonal box with thin pen > > thdraw fullcircle scaled u withpen PenD; > > enddef; > > > > initsymbol("p_u_graffiti") > > text en "point u:graffiti" "Historic graffiti" > > Bruce > > > > From: Bruce Mutton <br...@tomo.co.nz> > Sent: Tuesday, 29 May 2018 10:15 PM > To: 'List for Therion users' <therion@speleo.sk> > Subject: Defining a user symbol that contains a short text string > > > > Good evening > > I'd like to make a user defined symbol that is simply an ascii text string. > A quick and dirty adhoc symbol if you like. If I was going to be fancy, I > would add a box around it like in the example of Dave Clucas that I have > copied and modified below. > > > > So rather than defining the shape of the omega symbol using metapost, I'd > like to hard code an ascii character, say "E". > > The yellow shaded text below needs to be replaced with some simple metapost, > but I am too lazy to research and trial things. > > I notice that other examples tend to use a copy of the p_label definition, > and modify that. I would rather not head down that route, as then my custom > code would overwrite potential future improvements to Therion's source code. > > > > > My plan is not really to create an alternative to the entrance symbol, but > rather to create a template quick and dirty creation of single use or > unusual symbols, that can be enumerated in the legend. > > > > Does anyone happen to know how to modify the code below to do what I > describe? > > > > Thanks > > Bruce > > > > > <https://therion.speleo.sk/wiki/_detail/metapost:entrancesymbol.png?id=metap > ost> > > code metapost > > def p_u_ent (expr pos,theta,sc,al)= > > U:=(.2u,.5u); > > T:=identity aligned al rotated theta scaled sc shifted pos; > > path p; > > p = (-.3u,-.25u) -- (-.2u,-.25u){dir 135} .. (0u, .25u) .. {dir > 225}(.2u,-.25u) -- (.3u,-.25u); % define omega shape > > thdraw p withpen PenA; % draw it with fat pen > > thdraw unitsquare scaled u shifted (-0.5u,-0.5u) rotated 45 withpen PenD; > % diagonal box with thin pen > > enddef; > > > > initsymbol("p_u_ent") > > def p_u_ent_legend = > p_u_ent( <I forget where to find code for point drawing in the > legend> ) > enddef; > endcode > text en "point u:ent" "E for entrance" #text to appear in legend > > > > > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > <http://mailman.speleo.sk/pipermail/therion/attachments/20180531/5077baf5/attachment.html> > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: image001.png > Type: image/png > Size: 8640 bytes > Desc: not available > URL: > <http://mailman.speleo.sk/pipermail/therion/attachments/20180531/5077baf5/attachment.png> > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: image002.png > Type: image/png > Size: 36421 bytes > Desc: not available > URL: > <http://mailman.speleo.sk/pipermail/therion/attachments/20180531/5077baf5/attachment-0001.png> > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: image003.png > Type: image/png > Size: 4840 bytes > Desc: not available > URL: > <http://mailman.speleo.sk/pipermail/therion/attachments/20180531/5077baf5/attachment-0002.png> > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Therion mailing list > Therion@speleo.sk > https://mailman.speleo.sk/listinfo/therion > > > ------------------------------ > > End of Therion Digest, Vol 149, Issue 35 > ****************************************
_______________________________________________ Therion mailing list Therion@speleo.sk https://mailman.speleo.sk/listinfo/therion