# Stretchable parentheses in text labels in Graphics

I'm trying to annotate a plot with points of the form $$\left(\frac{1}{2},\frac{1}{2}\right)$$; my problem is that the parentheses don't stretch to cover the fraction. I think that what I want to do is to use a StyleBox inside the Graphics primitive to allow me to format the string using SpanMaxSize, but StyleBox is not a text string. I cannot figure out how to make this work. Is there an easier way?

So for example, if I use

Graphics[Text[Style["(1/2,sqrt(3)/2)", Black, 12], {-1.1, .8}]]


with the 1/2 and sqrt(3)/2 formatted in OutputForm, I get

• Try MaTeX? MaTeX["\\left(\\frac{1}{2}\\right)"] Dec 19 '20 at 14:52

In graphics, Text objects render in TraditionalForm. In TraditionalForm, parentheses are used instead of square brackets. So you can achieve what you want by using an expression with an invisible head:

Graphics[Text[Style[Invisible[""][1/2,Sqrt[3]/2],Black,12],{-1.1,.8}]]


There are other ways to achieve this behavior, but they require learning a bit about how boxes work.

• Works great, but can you explain why? Why does an invisible head change the output? Dec 20 '20 at 1:03
<< MaTeX

Plot[0, {x, -1, 1},
Epilog -> { Point[{-1/2, Sqrt[3]/2}],
Inset[MaTeX[
"\\left(-\\frac{1}{2},\\frac{\\sqrt{3}}{2}\\right)"], {-1/2 +
0.1, Sqrt[3]/2 - 0.3}]}]
`

• Can you clarify how the new 12.2 TeX typesetting does in such a case? Dec 19 '20 at 23:56
• @CATrevillian 12.2 doesn’t use Tex to typeset, it merely converts the Tex strings into mma boxes Dec 21 '20 at 1:36