I would ideally like to not have to spend a lot of time writing LaTeX for complicated algebraic expressions that I've worked out in Mathematica. I know that I can "copy-as-LaTeX", but my current issue is that my algebraic expressions are often formatted slightly wrong.
(Additionally, any general tips for working between $ \mathrm\LaTeX $ and Mathematica would be appreciated!)
EDIT: Explicitly showing the code:
expression = -p12 β - 1/2 I (2 p12 (Δc - Δp) - p42 Ωa + p13 Ωc - p32 Ωp + p14 Ωs)
For example for the following algebraic expression:
I would like it to be sorted by variables in the following order (p12, p13, p14, p32, p42):
To look like:
$ (-\beta - i (\text{$\Delta $c}-\text{$\Delta $p}))\text{p12}+\text{$\Omega $c} \text{p13} +\text{$\Omega $s} \text{p14} - \text{$\Omega $p} \text{p32}-\text{$\Omega $a} \text{p42} $
If I use this code:
Collect[expression, {p12, p13, p14, p32, p42}]
it doesn't seem to organize the variables in this order (of {p12, p13, p14, p32, p42}
). instead, it returns an ordering:
Additionally...I've observed that if I copy-as latex, what is above appears. But if I look at what I am copying, it has this form:
$\text{p12} (-\beta +i (\text{$\Delta $p}-\text{$\Delta $c}))-\frac{i \text{p13} \text{$\Omega $c}}{2}-\frac{i \text{p14} \text{$\Omega $s}}{2}+\frac{i \text{p32} \text{$\Omega $p}}{2}+\frac{i \text{p42} \text{$\Omega $a}}{2}$
Collect
gives the "wrong" parsing of an equation? $\endgroup$Plus
isOrderless
$\endgroup$