Message Boards Message Boards

Export LaTeX unaltered to a tex file?

I am trying to use Mathematica to combine computations and actual typesetting, as opposed to just typesetting in LaTeX. I would like to be able to type LaTeX into a Mathematica cell and have it sent through unaltered to the .tex file output when I export, so that TeX compiles it into an actual equation.

I am aware of ToExpression and TeXForm, but when a cell in TeXForm is exported to a .tex document, it is escaped so that the raw TeXForm code is what shows in the final compiled PDF, rather than the typeset equation. Also, Mathematica's TraditionalForm is unable to display many things that LaTeX knows how to deal with.

Is there any way for me to reliably type LaTeX code into my Mathematica document, and have it just sent through unescaped so that it can be compiled by LaTeX itself, rather than using mathematica expressions as an intermediary?

Thanks very much for any response.

POSTED BY: Stephen Jones
3 Replies

You may have a look at the MaTeX package by Szabolcs Horvát MaTeX.

POSTED BY: Gianluca Gorni
Posted 2 years ago

I had a similar problem: Exporting TeXForm to a .tex file using Export["somefile.tex", TeXForm[...]] produced code that escaped all tex and rendered a PDF with the TeX code itself. Explicitly specifying the output format as "String" resolved the issue:

Export["somefile.tex", TeXForm[...], "String"]

POSTED BY: Gurtej Kanwar

There's an error in the MaTeXInstall Resource Function: evaluating it in Mathematica 12.3.1 (under macOS 11.5.2) causes a Join error.

POSTED BY: Murray Eisenberg
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