Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create a graphical brace object
ResourceFunction["GraphicsBrace"][label,leftpt,rightpt] creates a brace graphical object annotated by label that stretches from point leftpt to point rightpt. | |
ResourceFunction["GraphicsBrace"][label,leftpt,rightpt,vertlen] creates the brace with edge lines of length vertlen. | |
ResourceFunction["GraphicsBrace"][{label,offset},leftpt,rightpt,vertlen] creates the brace with the label offset by the distance offset from the brace cusp. | |
ResourceFunction["GraphicsBrace"][{label,offset,relpos},leftpt,rightpt,vertlen] creates the brace with the label and cusp displaced by distance relpos from the left edge. | |
ResourceFunction["GraphicsBrace"][{label,{offset,textoffset},relpos},leftpt,rightpt,vertlen] creates the brace with the textual label using additional offset textoffset. |
RotateLabel | True | whether to rotate the label; if so, how much |
RoundingRadius | 0.02 | rounding radius of the joints of the brace curve |
Direction | Automatic | direction in which the edges extend from the anchor points |
True | False | whether to rotate the label or not |
α | rotate the label through a fixed angle |
{False,α} | rotate the label through a fixed angle |
{True,α} | add a fixed angle to the automatically calculated rotation |
r | set the radius of the joints |
{rout,rin} | set the radius of the outer joints and the inner joints, i.e. the cusp, independently |
Automatic | adjust the direction according to the anchor points |
α | direction given by an angle |
{x,y} | direction given by a vector |
Annotate a graphical object with an underbrace:
In[1]:= | ![]() |
Out[1]= | ![]() |
Use multiple annotations:
In[2]:= | ![]() |
Out[3]= | ![]() |
By swapping the order of the two anchor points, create an overbrace:
In[4]:= | ![]() |
Out[5]= | ![]() |
Adjust the position and rotation of the label:
In[6]:= | ![]() |
Out[7]= | ![]() |
By default, the brace automatically adjusts its rotation to the annotated object:
In[8]:= | ![]() |
Out[9]= | ![]() |
Style the labels as well as the curves:
In[10]:= | ![]() |
Out[11]= | ![]() |
Use Point objects directly as anchor points:
In[12]:= | ![]() |
Out[14]= | ![]() |
Use the underbrace with no label:
In[15]:= | ![]() |
Out[15]= | ![]() |
The label does not have to be text:
In[16]:= | ![]() |
Out[16]= | ![]() |
Position the label further from the cusp:
In[17]:= | ![]() |
Out[18]= | ![]() |
The offset is taken in the direction of the cusp:
In[19]:= | ![]() |
Out[19]= | ![]() |
The textual label can be offset in the horizontal and vertical directions using an additional argument:
In[20]:= | ![]() |
Out[20]= | ![]() |
Any specification that is valid for the third argument of Text is also allowed. Here, an Offset is used:
In[21]:= | ![]() |
Out[21]= | ![]() |
Specify the relative position of the label with respect to the edges:
In[22]:= | ![]() |
Out[22]= | ![]() |
Make the edges longer:
In[23]:= | ![]() |
Out[23]= | ![]() |
Specify the relative position of the cusp with respect to the edges:
In[24]:= | ![]() |
Out[24]= | ![]() |
Choose different colors, thicknesses, etc. for the curve:
In[25]:= | ![]() |
Out[25]= | ![]() |
Choose different styles for the label:
In[26]:= | ![]() |
Out[26]= | ![]() |
Style both the curve and the label:
In[27]:= | ![]() |
Out[27]= | ![]() |
By default, the curve stretches between the two anchor points:
In[28]:= | ![]() |
Out[30]= | ![]() |
Specify explicitly the direction of the edges:
In[31]:= | ![]() |
Out[31]= | ![]() |
The direction can also be specified as a vector:
In[32]:= | ![]() |
Out[32]= | ![]() |
The label is by default parallel to the brace:
In[33]:= | ![]() |
Out[33]= | ![]() |
Disable rotation:
In[34]:= | ![]() |
Out[34]= | ![]() |
The angle can also be given explicitly:
In[35]:= | ![]() |
Out[35]= | ![]() |
The combination of both approaches yields an automatically rotated label with the explicitly given rotation offset:
In[36]:= | ![]() |
Out[36]= | ![]() |
Adjust the radius of the joints:
In[37]:= | ![]() |
Out[37]= | ![]() |
The radius of the cusp and outer joints can be specified independently:
In[38]:= | ![]() |
Out[38]= | ![]() |
Make a technical drawing with proper physical units:
In[39]:= | ![]() |
Out[39]= | ![]() |
Describe the regions where a given function is monotonically increasing and decreasing:
In[40]:= | ![]() |
Out[41]= | ![]() |
In[42]:= | ![]() |
Out[42]= | ![]() |
GraphicsBrace can be used in Graphics the way that an underbrace is used in text:
In[43]:= | ![]() |
Out[43]= | ![]() |
When the first argument is to be taken as a literal, wrap it in Inset:
In[44]:= | ![]() |
Out[44]= | ![]() |
When the other arguments are not numeric, no evaluation of GraphicsBrace takes place:
In[45]:= | ![]() |
Out[46]= | ![]() |
In[47]:= | ![]() |
Out[47]= | ![]() |
The label may be set too close to the cusp:
In[48]:= | ![]() |
Out[49]= | ![]() |
Position the label further from the cusp:
In[50]:= | ![]() |
Out[50]= | ![]() |
When the line segments are too small with respect to the rounding radii, undesired behavior occurs:
In[51]:= | ![]() |
Out[51]= | ![]() |
To prevent this, adjust the rounding radii appropriately:
In[52]:= | ![]() |
Out[52]= | ![]() |
For an overbrace, the label is upside down:
In[53]:= | ![]() |
Out[53]= | ![]() |
Turn off the automatic rotation of the label:
In[54]:= | ![]() |
Out[54]= | ![]() |
Use the brace as a graphics primitive for artistic drawing:
In[55]:= | ![]() |
Out[55]= | ![]() |
Annotate the side lengths of a dynamically changing triangle:
In[56]:= | ![]() |
Out[60]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License