3
$\begingroup$

a simple example Text Cell Style with a inline Cell (DisplayFormula)

Cell[TextData[{"inline mode ",Cell[BoxData[FormBox[RowBox[{"f", "(", "x", ")"}], TraditionalForm]], "DisplayFormula", FormatType->"TraditionalForm"], " "}], "Text"]

setting in Options DefaultNewInlineCellStyle is DisplayFormula.

If setting in Options DefaultNewInlineCellStyle is Text this would not happen.

I think someone would also encounter the situation: Converting between TraditinalForm and StandardForm sometimes auto-add or remove some ().

When copy as Latex, it's ok to compile in WinEdt(my tex compiler‘s access)

f \text{inline} \text{mode} x

f(x)

\text{Null}

but when save notebook as .tex, load in file f(x) becomes

\(\(f(x)\)\)

The right should be

\(f(x)\)

enter image description here


I asked on the TeX StackExchange site and got some comments"

I am not on the other site, but in your Mathematica set-up it does not make much sense to say that inline should be rendered as DisplayFormula. My guess is the converter used to output $…$ for inline math and $$…$$ for display. Now \(…\) is often to be preferred for inline, but the display equivalent is \[…\] not \(\(…\)\). – Andrew Swann

This is a good point.

DisplayFormula ==> $$
InlineFormula ==> $

This is MathJax.

However, maybe the same to \(.

As Silvia's former suggestion, I should just not use DisplayFormula in inline cells.

But I still need to check: would some other inline styles generate such double \(s?

$\endgroup$
8
  • 2
    $\begingroup$ OT: WinEdt is an editor/IDE, not a TeX compiler. $\endgroup$
    – Silvia
    Commented May 27, 2013 at 16:12
  • $\begingroup$ @Silvia yeah, you're right. If I use CCompiler in Mathematica, I would probably say: When I open Mathematica(my C Compiler)...it's much simpler in my opinion,anyway I added an access in the post. $\endgroup$ Commented May 28, 2013 at 2:36
  • $\begingroup$ I think you simply should not use DisplayFormula for inline formula.. Just like you should not use $$\int_a^b f(x)\,\mathrm{d}x$$ for inline formula in LaTeX. $\endgroup$
    – Silvia
    Commented May 28, 2013 at 3:08
  • $\begingroup$ @Silvia en, seems the double (( ' problem is not because of DisplayFormula which really not so necessary. But I'm not sure about this question, I should take time to do more tries. $\endgroup$ Commented May 30, 2013 at 3:10
  • $\begingroup$ @Silvia In the previous simple case, I now accept your suggestion not use DisplayFormula in inline cells. Though still need to keep the track of whether other styles would generate such double \(s $\endgroup$ Commented Jun 28, 2013 at 13:05

1 Answer 1

2
$\begingroup$

When you Copy as LaTeX from the Edit menu, the assumption is that your highlighted expression is mathematics. The result is just the stuff that goes between the LaTeX delimiters. You're expected to place them between dollar signs or double dollar signs or whatever you want to use yourself.

Note that this is similar to the behavior of TeXForm:

TeXForm[Integrate[f[x], x]]

(* Out: \int f(x) \, dx *)

By contrast, Export to TeX generates an entire LaTeX document, which includes delimiters.

ExportString[Integrate[f[x], x], "TeX"]

(* Out:
%% AMS-LaTeX Created by Wolfram Mathematica 9.0 : www.wolfram.com

\documentclass{article}
\usepackage{amsmath, amssymb, graphics, setspace}

\newcommand{\mathsym}[1]{{}}
\newcommand{\unicode}[1]{{}}

\newcounter{mathematicapage}
\begin{document}

\[\int f[x] \, dx\]

\end{document}
*)

Finally, we can now see why the "inline" and the "mode" were included in LaTeX \text commands - because that's necessary to have the display as text inside the LaTeX delimiters that you are expected to provide.

$\endgroup$

Your Answer

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

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