# Multiplication with custom notation

I would like to compute the product

$$(Es+r_{13})(F_{13}s)(F_{3}s+r_{3})(F_{2}s+r_{2})(F_{12}s+r_{12})(F_{1}s+r_{1})(F_{23}s+r_{23})$$

where $$E$$, $$F_i$$, and $$r_i$$ represent arbitrary numbers whose notation makes sense in the general problem I am working on.

When I simply copy and paste the LaTex expression into Mathematica, I get some weird stuff which clearly is not the product.

What I am doing wrong?

## 2 Answers

str = "(e*s+r_{13})(F_{13}s)(F_{3}s+r_{3})(F_{2}s+r_{2})(F_{12}s+r_{12})(F_{1}s+r_{1})(F_{23}s+r_{23})";
ToExpression[str, TeXForm]

(*    s Subscript[F, 13] (s Subscript[F, 1] + Subscript[r, 1])
(s Subscript[F, 2] + Subscript[r, 2]) (s Subscript[F, 3] + Subscript[r, 3])
(s Subscript[F, 12] + Subscript[r, 12]) (e s + Subscript[r, 13])
(s Subscript[F, 23] + Subscript[r, 23])                     *)

• Can I further ask how to ask mathematica to only show the coefficients of s^3 terms in the product? – crystal_math Jan 9 at 14:35
• Yes, with Coefficient[%, s^3]. – Roman Jan 9 at 14:57
• Please note that I've modified the first term from Es to e*s because Es is a single symbol. – Roman Jan 9 at 15:02

You can remove the space from the pasted-in LaTeX expression so your $$Es$$, which was interpreted as $$E s$$, goes back to being $$Es$$.

Expression as pasted in: which evaluates to: Edit the expression to: so it now evaluates to: which is what I presume you want.