4
$\begingroup$

I am using MaTeX to put a box on a graph with an outline. The code looks like this:

eps = Epilog -> {Inset[Framed[MaTeX["\\text{0.2~mA/ns}"], RoundingRadius -> 4 ], {105 , 32}, Background -> White  ]

I want to insert a line break, so that after the "ns", but can't figure out how to do this. I have tried \\\\ and \\newline and \\linebreak, but they are ignored. How can I achieve this?

$\endgroup$
4
$\begingroup$

MaTeX interprets its input in inline math mode, which means that normally no newlines are allowed. Depending on why you want a newline, you can do one of the following:

  • For multiline equations, use an appropriate math-mode environment.

    MaTeX["
      \\begin{aligned}
      a &= b+c \\\\
      c + d &= e
      \\end{aligned}
     "]
    

    enter image description here

  • Use Mathematica's facilities to stack lines.

    Column@MaTeX[{"\\text{one}", "x+y"}]
    

    enter image description here

  • If you really want to use LaTeX's facilities for multiline typesetting, it's possible, but it's not pretty. You can create a parbox of a given size, then type LaTeX commands as usual (including \\, which of course must appear as "\\\\" in a Mathematica string). Here's an example lifted directly from the MaTeX documentation:

    MaTeX["\\text{\\parbox{6cm}{
     The items are:
     \\begin{itemize}
     \\item First
     \\item Second
     \\end{itemize}
     }}"]
    

    enter image description here

| improve this answer | |
$\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.