Re: [Therion] Defining a user symbol that contains a short text string

2018-05-31 Thread Dave Clucas via Therion
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 
> To: therion@speleo.sk
> Cc: Dave Clucas MY 
> 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" 
>> To: "'List for Therion users'" 
>> Subject: [Therion] Defining a user symbol that contains a short text
>>string
>> Message-ID: <000401d3f735$e5d86d90$b18948b0$@tomo.co.nz>
>> Content-Type: text/

Re: [Therion] Defining a user symbol that contains a short text string, Therion Digest, Vol 149, Issue 34

2018-05-30 Thread Dave Clucas via Therion
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 

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" 
> To: "'List for Therion users'" 
> 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
> 
> 
> 
> 
>  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(  legend> )
> enddef;
> endcode
> text en "point u:ent" "E for entrance" #text to appear in legend
> 
> 
> 
> 
> 
> 
> 
> 
> -- next part --
> An HTML attachment was scrubbed...
> URL: 
> 
> -- next part