Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
2  
OT: WinEdt is an editor/IDE, not a TeX compiler. –  Silvia May 27 '13 at 16:12
    
@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. –  HyperGroups May 28 '13 at 2:36
    
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. –  Silvia May 28 '13 at 3:08
    
@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. –  HyperGroups May 30 '13 at 3:10
    
@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 –  HyperGroups Jun 28 '13 at 13:05
show 3 more comments

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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