3

Here is one problem I encountered with in Converting Mathematica Notebook to TeX:
https://mathematica.stackexchange.com/questions/25928/save-as-tex-fx-double-s-problem

And I got some double \('s

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

Is this a problem of Mathematica? I do not know where else would generate some similar \(s

And, if I cannot control Mathematica to generate single \(, how to change the \(\( to \( conveniently ?

I sometimes use Find/Replace to remove that redundant \( in WinEdt

enter image description here

7
  • @percusse Is it possible to compile two \(\('s ((f(x)(( without errors, in (for example) WinEdt? Jun 28, 2013 at 12:16
  • 2
    Although it is possible, it is not a good idea. It would be a much better plan to figure out what is causing those double \(s and fix that. It will make your life sooo much easier! Jun 28, 2013 at 12:28
  • 6
    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 dispaly equivalent is \[...\] not \(\(...\)\). Jun 28, 2013 at 12:32
  • @AndrewSwann aha, something similar, good point. Maybe that's the answer. Jun 28, 2013 at 12:51
  • 1
    I feel like this is a Mathematica question rather than a LaTeX one. Jun 28, 2013 at 16:53

2 Answers 2

6

We can change the definition of \( and \) so that they check whether they are followed by another occurrence of themselve and \@gobble that.

These leave the math-shifts $ and $$ as they are, meaning that LaTeX’s superior \[/\] will be used.

Though, it would be better to fix Mathematica’s bug …

Code

\documentclass{article}
\makeatletter
\let\orig@mo\(
\let\orig@mc\)

% (choose one)
% \(\( = display style
\def\({\kernel@ifnextchar\({\expandafter\[\@gobble}\orig@mo}
\def\){\kernel@ifnextchar\){\expandafter\]\@gobble}\orig@mc}

% \(\( = inline math
\def\({\kernel@ifnextchar\({\expandafter\orig@mo\@gobble}\orig@mo}
\def\){\kernel@ifnextchar\){\expandafter\orig@mc\@gobble}\orig@mc}
\makeatother

\begin{document}
inline $ \frac {x^2}{y} $

display $$ \frac {x^2}{y} $$

inline \( \frac {x^2}{y} \)

display \(\( \frac {x^2}{y} \)\)
\end{document}
0
4

Almost certainly this is a badly configured conversion wher einline math has changed from $ to \( which has had an accidental effect where $$ has changed to \(\(.

Fixing the convertor would be best but if you go

\let\($  \let\)$

Then \( will act like $ and

aaa\(a=b\)bbbbaaa\(\(c=d\)\)bbbb

will work like

aaa$a=b$bbbbaaa$$c=d$$bbbb

with a=b in inline math annd c=d in display math.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .