1
$\begingroup$

Consider the code

lin = Graphics[{Red, Line[{{0.5, 0}, {0.5, 1}}]}];
rect = Graphics[{Rectangle[], 
    Inset[Style[Text["aaa"], 20, White, Bold, 
      TextAlignment -> Left]]}];
Show[rect, lin]

enter image description here

I want to start writing from left to right after the red line (or at a given $x$ position), that is

enter image description here

and so that when I had more letter, it writes on the right:

enter image description here

How do I do this? I've tried playing around with TextAlignment or TextJustification with no success.

$\endgroup$
1
  • $\begingroup$ Graphics[{Rectangle[], Red, Line[{{0.5, 0}, {0.5, 1}}], Text[Style["aaa", 20, White, Bold], {0.5, 0.5}, {-1.2, 0}]}] $\endgroup$
    – Bob Hanlon
    Mar 29 at 18:49
2
$\begingroup$

Add to Inset[] the following arguments : , Center, {Left, Center} :

lin = Graphics[{Red, Line[{{0.5, 0}, {0.5, 1}}]}];
rect = Graphics[{Rectangle[], Inset[
     Style[Text["aaabbb"], 20, White, Bold(*,TextAlignment\[Rule]Left*)]
     , Center, {Left, Center}
     ]}];
Show[rect, lin]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.