I would like to formulate a question in a notebook for my students using $\LaTeX$ (or $MathML$) to typeset functions and matrices. I specifically want a language other than Mathematica as students will have to replicate the output using Mathematica.

Is there a way of using $\LaTeX$ in text?

Is it also possible to generate $\LaTeX$ output when setting up a notebook in a text editor?

I have found solutions for using $\LaTeX$ in Mathematica commands but this does not work in text.

  • 3
    $\begingroup$ Take a look at MaTeX from our friend Szabolcs. It may help. $\endgroup$
    – MarcoB
    Commented Jul 10, 2017 at 14:34
  • 2
    $\begingroup$ Load MaTeX, then (for instance): << MaTeX ` then MaTeX@HoldForm[Sum[1/k^3, {k, 1, \[Infinity]}]] $\endgroup$ Commented Jul 10, 2017 at 15:22
  • 1
    $\begingroup$ If you just want to state a problem mathematically in a Text cell that students will answer by using entering expressions in a Input cell, Mma notebooks already offer extensive math formatting capabilities in text cells. (Or, did you want something else?) $\endgroup$
    – Alan
    Commented Jul 10, 2017 at 15:36
  • 1
    $\begingroup$ Are you looking for LaTeX or are you looking for mathematical typesetting? If the latter, check these: reference.wolfram.com/language/tutorial/… wolfram.com/language/fast-introduction-for-math-students/en/… $\endgroup$
    – Szabolcs
    Commented Jul 10, 2017 at 16:09
  • 1
    $\begingroup$ I believe what the questioner wants is a way to display a matrix in a Mathematica text cell which does not involve using the Wolfram language (at least not directly) to accomplish the formatting. Otherwise, their students could just copy & paste the objects from the text cells into the "input" cells. (If that's the case, then I'd probably just use a stand-alone program like LaTeXiT and include the "formatted" mathematics as images.) $\endgroup$ Commented Jul 10, 2017 at 17:59

1 Answer 1


Question not clear. But to insert Latex Matrix (or any other latex output, such as equations etc..) in textcell using the notebook, here is an example. If OP does not want to use the notebook at all, then this is not possible and will delete this.

Load Matex to render the Latex. Start text cell. Insert the latex in the textcell from the rendered output. Here is an example

enter image description here


matrix = Table[i + j, {i, 1, 3}, {j, 1, 4}];
matrixAsLatex = MaTeX@TeXForm[matrix]

However, I would not do it this way if I were you. I use Mathematica all the time to generate Latex, but I output direct Latex to a file which later compile using lulatex directly. I use this method to generate hundreds of PDF files and reports all from Mathematica. (I do not use Export Latex at all either). But to do this, you need to know little Latex and make heavy use of TeXFrom as well when needed. Will try to post an example of how this method works if needed, but you asked for using textcell.

An option between using texcell and full method I use is to render the whole thing as String in the notebook. Here is an exammple

equation = y'[x]==x;

ANd now type

string="\\text{My Matrix in Latex is} "<>ToString@TeXForm[matrix]<>
       " \\text{which looks nice and my equation is } \\fbox{"
       <>ToString@TeXForm[equation]<>"}\\text{ which Mathematica can 
       solve giving the answer}"<>ToString@TeXForm@sol;


Which gives

Mathematica graphics

Or you can use Row instead, as in

string=Row[{"My Matrix in Latex is ",
           "which looks nice and my equation is ",
           " which Mathematica can solve giving the answer "

Mathematica graphics

The method I use, does not do the above, but sends all output to file. So it is basically as if one is writing plain Latex, but sending output to file, and using Mathematica to do the computation and convert results to Latex as needed.

  • $\begingroup$ super-cool demo. $\endgroup$
    – user1066
    Commented Jul 10, 2017 at 20:27
  • $\begingroup$ Do you think this is a duplicate of How to use LaTeX for typesetting labels and titles in Mathematica? I don't want to be too hasty because I don't understand the question, but it looks very similar to me. $\endgroup$
    – Jens
    Commented Jul 10, 2017 at 22:10
  • 1
    $\begingroup$ @Jens I really do not know. OP asked for Latex in textcell (using text editor?) There are number of Other Latex related questions on this site as well. But if you think it is duplicate, feel free to close it. I still do not understand fully what the OP is asking for actually :) $\endgroup$
    – Nasser
    Commented Jul 10, 2017 at 22:20
  • $\begingroup$ Thank you for all the answers. I don't feel this is a duplicate as I want to typeset math in a text cell, not a command. I also want to generate the text outside Mathematica. I hope this and my comment above clarifies my problem. $\endgroup$
    – user49947
    Commented Jul 11, 2017 at 7:40
  • 1
    $\begingroup$ @user49947 I am sorry, I still have no idea what you want to do. TextCell is by definition a construct inside a notebook. It works only in a notebook. I did not use Maple TA, so I do not know how it works. As far as I know, only Mathematica can author notebooks. I do not think there is software which can create Mathematica notebooks that will run inside Mathematica which is not generated by Mathematica itself. I still do not know why you do not want to use Mathematica to generate the Latex. $\endgroup$
    – Nasser
    Commented Jul 12, 2017 at 1:28

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