1
$\begingroup$

I have been researching today the possibility of creating interactive mathematics documents using Mathematica for use in the classroom. I want to be able to use LaTeX typesetting within my notebook for the aesthetics and have downloaded MaTeX.

I have the following code:

MaTeX[Text["f(x) = a_nx^n + Subscript[a, n-1] x^(n-1) + ... + a_1x+a_0"], FontSize -> 40]

that results in

enter image description here

Notice that the left hand side of the equation is typeset differently from the beginning of the right hand side and the same is true for the linear term on the right. I used the typesetting palette for the centerdots. Not as written in the code.

If I remove the Text[] or change it to Print[] or remove the quotes or remove Text[] and quotes all return error messages.

How could I change it to have the entire expression typeset normally? One broader question would be how difficult would it be for Mathematica developers to design $\$math\$$ notation for interpreting as LaTeX? Seems like MathematicaSE quickly picked up on what I intended. If not $ then maybe some other pair of symbols.

$\endgroup$
4
  • 1
    $\begingroup$ I am really note sure what you are doing. Why not simply write this expr="f(x)=a_n x^n+a_{n-1} x^(n-1)+ \\dots+a_1 x+a_0"; MaTeX[expr, FontSize -> 40] and this gives what you want !Mathematica graphics I would not do it the way you are doing it below. $\endgroup$
    – Nasser
    Jun 10, 2018 at 3:43
  • $\begingroup$ @Nasser Looks like the problem was with the dots. I tried to put them in with the palette and I think they were being interpreted as multiplications. The syntax in my answer contains some of what was given by TeXForm[expr]. This is what I got from TeXForm: \text{f(x) = }a_nx^n\text{ + }a_{n-1}x^{n-1}\text{ +$\cdot \cdot \cdot $+ }a_1\text{x + }a_0 $\endgroup$
    – JEM
    Jun 10, 2018 at 4:11
  • 1
    $\begingroup$ It hard to advice, since the full context of what you are going is not clear. You did not explain in the question what is the original input and where it came from and the workflow you are using is. You can either send MaTeX correct Latex or send it correct Mathematica code. But you seem to be making things much harder than they need to be. $\endgroup$
    – Nasser
    Jun 10, 2018 at 4:32
  • $\begingroup$ @Nasser I am creating an interactive notebook about polynomial functions intended for classroom presentation. I created a section called "General Properties" and wanted to display the standard form of an order n polynomial and I wanted my slide to display it with LaTeX at the top and then generate some bullets one by one listing things like Gauss' Theorem, Abel's Theorem, and so on. I'm still working on the animated bullets. $\endgroup$
    – JEM
    Jun 10, 2018 at 5:08

1 Answer 1

1
$\begingroup$

I found a solution:

MaTeX["f(x) \\text{ = } a_nx^n \\text{ + }a_{n-1}x^{n-1}\\text{ + \}\cdots \\text{ + }a_1x\\text{ + }a_0", FontSize -> 40]

returns

enter image description here

I had to think LaTeX syntax not Mathematica syntax. So in effect you can think of one use of MaTeX is as the double string wrapper for LaTeX save for the pesky double slash. Very Nice Szabolics thank you.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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