Message Boards Message Boards

0
|
4025 Views
|
10 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Display PlotLabel as multi-line system of equations with left brace

Can Mathematica display a PlotLabel as a multi-line system of equations with a left brace? Not a two-column step-wise function.

POSTED BY: Jay Gourley
10 Replies

I have it installed as a palette in my system. I am glad it is useful for others too.

POSTED BY: Gianluca Gorni

Years ago I found this solution to typeset systems of equation within Mathematica:

Grid[{{PasteButton[
    DisplayForm[
     StyleBox[
      RowBox[{StyleBox["{", SpanMaxSize -> \[Infinity]], 
        GridBox[{{"\[Placeholder]"}, {"\[Placeholder]"}}, 
         ColumnAlignments -> Left]}], ShowAutoStyles -> False]]], 
   PasteButton[
    DisplayForm[
     StyleBox[
      RowBox[{StyleBox["{", SpanMaxSize -> \[Infinity]], 
        GridBox[{{"\[Placeholder]"}, {"\[Placeholder]"}, {"\
\[Placeholder]"}}, ColumnAlignments -> Left]}], 
      ShowAutoStyles -> False]]], 
   PasteButton[
    DisplayForm[
     StyleBox[
      RowBox[{StyleBox["{", SpanMaxSize -> \[Infinity]], 
        GridBox[{{"\[Placeholder]"}, {"\[Placeholder]"}, {"\
\[Placeholder]"}, {"\[Placeholder]"}}, ColumnAlignments -> Left]}], 
      ShowAutoStyles -> False]]]}}, Spacings -> 0]
POSTED BY: Gianluca Gorni

That's great, Gianluca. Thumbs up. It looks good in TraditionalForm[] too. When I get time, I'll put your code into a function. Maybe call it SystemOfEquations[{eq1,...,eq7}].

POSTED BY: Jay Gourley
Posted 2 years ago

Hi Jay,

Can you please provide an example? What is "a two-column step-wise function"? For "a multi-line system of equations with a left brace" do you mean

f[x_] := Piecewise[{{Sin[x]/x, x < 0}, {1, x == 0}}, -x^2/100 + 1];
Plot[f[x], {x, -Pi, Pi}, PlotLabel -> f[x]]

enter image description here

You can provide any expression to PlotLabel, by default its TraditionalForm will be displayed.

POSTED BY: Rohit Namjoshi

Thanks, Rohit, for the quick reply. By "a multi-line system of equations with a left brace," I meant something like this:

enter image description here

By "a two-column step-wise function," I meant something like your example where the first column contains the functions and the next column contains their domains.

POSTED BY: Jay Gourley
Posted 2 years ago

If you are familiar with LaTeX then you can use the MaTeX package for typesetting.

Needs["MaTeX`"];

label = MaTeX["\\left\\{
  \\begin{array}{@{}ll@{}}
    xy^2 = 5 \\\\
    x^3 - y = 10 \\\\
    y \\leq 0
  \\end{array}\\right.", Magnification -> 1.25]

an use PlotLabel -> label.

enter image description here

I did a search on MSE and found this, which is much easier if you have a list of expressions.

POSTED BY: Rohit Namjoshi

That works, Rohit. Thanks. I'm not fluent in LaTex, but I will only need it rarely. So unless someone has a better idea, this solves the problem.

POSTED BY: Jay Gourley
Posted 2 years ago

Jay,

Did you take a look at the MSE link at the bottom of my answer? It has several different solutions to this problem.

POSTED BY: Rohit Namjoshi

Yes, Rohit. I did check the MSE link. It looks like it is exactly on point. So thanks for the link. I had trouble following it. Most of the back and fort was discussing editing changes. So I was never clear on what the code was. It seemed to deal mostly with the PieceWise[] function. But I was not able to eliminate the second column using that function and didn't find anything in the documentation that said that was possible.

POSTED BY: Jay Gourley
Posted 2 years ago

Hi Jay,

Using the Format definition of bracket from that post

Format[bracket[obj_]] := Style[DisplayForm@RowBox[{"{", obj}], SpanMaxSize -> Infinity]

label = {Defer[xy^2 = 5], Defer[x^3 - y = 10], Defer[y <= 0]} // Column // bracket

or

label = HoldForm /@ Unevaluated@{xy^2 = 5, x^3 - y = 10, y <= 0} // Column // bracket

Then use it for PlotLabel

enter image description here

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract