1
$\begingroup$

I am constantly using the mathematica software and using TeXForm command to go back and forth between the calculations and the latex document I'm typesetting. However, mathematica won't allow me to define variables with underscore, which I constantly need in my latex document. Does anybody know how to create variables with "smarter" names in mathematica? In a broader sense, what is the best way to integrate the use of mathematica and latex? Thanks.

$\endgroup$

closed as off-topic by user9660, MarcoB, RunnyKine, m_goldberg, WReach May 2 '16 at 3:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Community, MarcoB, RunnyKine, m_goldberg, WReach
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Did you try TeXForm[Subscript[a, b]] ? $\endgroup$ – Alexey Bobrick Nov 2 '14 at 18:29
  • 1
    $\begingroup$ what is the best way to integrate the use of mathematica and latex? There are 2 ways: Export as tex using the menu, or use TeXForm for an expression. $\endgroup$ – Nasser Nov 2 '14 at 18:32
  • $\begingroup$ Alexey, it seems to work! Can I name variables using a backslash aswell? Thats for the greek letter in latex. $\endgroup$ – user191919 Nov 2 '14 at 18:48
  • $\begingroup$ Can I name variables using a backslash aswell? There is no need. Mathematica will add the backslash for you automatically when you export to Latex. Try TeXForm[Sin[x]] You'll see the result is \sin (x). I do not think a variable name can start with "\" in Mathematica. I just tried \x=5 in Mathematica, and it gave me syntax error. Version 10.01 on windows. $\endgroup$ – Nasser Nov 2 '14 at 19:05
  • $\begingroup$ @user191919: Yep! Do in analogy with this: 1) In the notebook press esc, 2) type "mu", 3) press esc again. You get a character which looks like greek mu. Use TeXForm to get latex code. Also, instead of mu you can use any latex symbol name (without slash). $\endgroup$ – Alexey Bobrick Nov 2 '14 at 19:07

Browse other questions tagged or ask your own question.