1
$\begingroup$

I typed this on Mathematica.

enter image description here

Subscript[a, 0] = 1/2 \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n\ odd\), \(\[Infinity]\)]
\*FractionBox[\(8  A\), 
SuperscriptBox[\((n\ \[Pi])\), \(2\)]]\) = 1/2 (8 A)/\[Pi]^2 \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n\ odd\), \(\[Infinity]\)]
\*FractionBox[\(1\), 
SuperscriptBox[\(n\), \(2\)]]\) = 1/2 (8 A)/\[Pi]^2 \[Pi]^2/8 = (A/2) 

Or the raw input form:

Subscript[a, 0] = (1/2)*Sum[(8*A)/(n*Pi)^2, {n*odd, Infinity}] = 
     (1/2)*((8*A)/Pi^2)*Sum[1/n^2, {n*odd, Infinity}] = 
       (1/2)*((8*A)/Pi^2)*(Pi^2/8) = A/2

And then I copy the cell as LaTeX I got this:

a_0=\frac{1}{2} \sum _{n \text{odd}}^{\infty } \frac{8 A}{(\pi  n)^2}=\frac{(8 A) \sum _{n \text{odd}}^{\infty } \frac{1}{n^2}}{2 \pi ^2}=\frac{\pi ^2 (8 A)}{2 \pi ^2 8}=\frac{A}{2}

However, if I display this LaTeX code I get a different look with the one I typed above.
Not that the numerator and demoninator are combined.
How can I copy the cell as LaTeX code but the look remains as what I typed?

enter image description here

$\endgroup$

1 Answer 1

2
$\begingroup$

That is expected due to internal transformation and automatic expression rewriting. Since you are using this for display only, you can add

\[CenterDot] 

between the terms you do not want combined which will now give this Latex

Mathematica graphics

Here is your input with

Subscript[a, 0] = 1/2 \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n\ odd\), \(\[Infinity]\)]
\*FractionBox[\(8  A\), 
SuperscriptBox[\((n\ \[Pi])\), \(2\)]]\) = 
  1/2 (8 A)/\[Pi]^2 \[CenterDot]\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n\ odd\), \(\[Infinity]\)]
\*FractionBox[\(1\), 
SuperscriptBox[\(n\), \(2\)]]\) = 
   1/2 \[CenterDot](8 A)/\[Pi]^2 \[CenterDot]\[Pi]^2/8 = (A/2) 

Screen shot

Mathematica graphics

I do not know of another way to prevent this. If you can find something better than \[CenterDot] you can try it. This gets transformed to \cdot in Latex.

\[CenterDot] is in basic typesetting palettes. Under operators

enter image description here

$\endgroup$
3
  • $\begingroup$ thanks, that is nice. \[CenterDot] work but Dot doesn't. Would be faster to type Dot than \[CenterDot] . $\endgroup$
    – hana
    Apr 5, 2022 at 20:48
  • 1
    $\begingroup$ @hana you can use Palettes to enter it. One click only. $\endgroup$
    – Nasser
    Apr 5, 2022 at 20:55
  • $\begingroup$ The answer is great but I just wonder if there is some way to automate this? Assume that I have more than 300 expressions so it would be really slow to manually input the center dot. $\endgroup$
    – hana
    Apr 6, 2022 at 5:32

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.