TeX - LaTeX Asked by Alejandro Camino on February 24, 2021
I am a begginer at LaTex
Bassically i want every fraction bar to have the same lenght as the natural lenght of the biggest one
I dont know if it would be better to use other command instead of equations, maybe an array or something like that
begin{equation}
begin{aligned}
dot { { x }_{ 1 } } = & enskip { x }_{ 2 }
dot { { x }_{ 2 } } = & enskip frac { beta gamma {{ x }_{ 2 }}^{ 2 }(sin ^{ 2 }{ { x }_{ 3 } } -1)sin { { x }_{ 3 } } }{ varphi beta -gamma ^{ 2 }+(beta ^{ 2 }+gamma ^{ 2 })sin ^{ 2 }{ alpha } }
&-frac { 2beta ^{ 2 }{ x }_{ 2 }{ x }_{ 4 }cos { { x }_{ 3 } } sin { { x }_{ 3 } } }{ varphi beta -gamma ^{ 2 }+(beta ^{ 2 }+gamma ^{ 2 })sin ^{ 2 }{alpha} }
&+frac { beta gamma {dot { {{ x }_{ 3 }}}^{ 2 }sin { { x }_{ 3 } } }-gamma delta cos { { x }_{ 3 } }sin { { x }_{ 3 } }+beta {tau}_{theta} }{ varphi beta -gamma ^{ 2 }+(beta ^{ 2 }+gamma ^{ 2 } sin ^{ 2 }{alpha} }
end{aligned}
end{equation}
This is how I'd type in the diagram. Note dot{x}_1
, so the dot is not at a weird position. I also removed several useless and difficult to parse braces. Also enskip
is not the right space to use. It should be mskipthickmuskip
, but it's easier to use &=
instead.
documentclass{article}
usepackage{amsmath}
begin{document}
begin{equation}
begin{aligned}
dot{x}_{1} &= x_{2}
dot{x}_{2}
&= frac{betagamma {x_{2}}^{2}(sin^{2} x_{3} - 1)sin x_{3}}
{varphibeta - gamma^{2}+(beta^{2} + gamma^{2})sin^{2}alpha}
&qquad
-frac{2beta^{2} x_{2}x_{4}cos x_{3} sin x_{3}}
{varphibeta - gamma^{2} + (beta^{2} + gamma^{2})sin^{2}alpha}
&qquad
+frac{betagamma{{}dot{x}_{3}}^{2}sin x_{3} - gammadeltacos x_{3}sin x_{3}
+betatau_{theta}}
{varphibeta-gamma^{2}+(beta^{2}+gamma^{2})sin^{2}alpha}
end{aligned}
end{equation}
end{document}
Now, if you want to equalize the last two fractions, you can use eqparbox
.
The first argument to eqfrac
is a label (here A
) unique to the fractions you want to equalize. Note that this might require multiple LaTeX runs, but you get a warning if a rerun is needed.
documentclass{article}
usepackage{amsmath}
usepackage{eqparbox}
newcommand{eqfrac}[3]{%
% #1 = label for the objects to equalize
% #2 = numerator
% #3 = denominator
frac{eqmakebox[#1][c]{$#2$}}{eqmakebox[#1][c]{$#3$}}%
}
begin{document}
begin{equation}
begin{aligned}
dot{x}_{1} &= x_{2}
dot{x}_{2}
&= frac{betagamma {x_{2}}^{2}(sin^{2} x_{3} - 1)sin x_{3}}
{varphibeta - gamma^{2}+(beta^{2} + gamma^{2})sin^{2}alpha}
&qquad
-eqfrac{A}{2beta^{2} x_{2}x_{4}cos x_{3} sin x_{3}}
{varphibeta - gamma^{2} + (beta^{2} + gamma^{2})sin^{2}alpha}
&qquad
+eqfrac{A}{betagamma{{}dot{x}_{3}}^{2}sin x_{3} - gammadeltacos x_{3}sin x_{3}
+betatau_{theta}}
{varphibeta-gamma^{2}+(beta^{2}+gamma^{2})sin^{2}alpha}
end{aligned}
end{equation}
end{document}
Do you really see an improvement? I don't, but it's just my opinion.
Correct answer by egreg on February 24, 2021
If you know what numerator or denominator is widest then you can measure it right before printing the equation using setbox
TeX primitive. Then you can do a construction:
{ hbox to<measured width>{$numerator$} over denominator }
for creating a fractions with wider fraction rule. It looks like:
newboxtmpbox
defcentereq#1{hbox towdtmpbox{hss$#1$hss}}
$$
setboxtmpbox=hbox{$beta gamma dot x_3^2 sin x_3
- gamma delta cos x_3 sin x_3 + beta tau_theta $}
eqalign{
dot x_1 &= x_2 cr
dot x_2 &= { beta gamma x_2^2 (sin^2 x_3 - 1) sin x_3 over
varphi beta - gamma^2 + (beta^2 + gamma^2) sin^2 alpha } cr
&quad - { centereq{2beta^2 x_2 x_4 cos x_3 sin x_3} over
varphi beta - gamma^2 + (beta^2 + gamma^2) sin ^2alpha } cr
&quad + { copytmpbox over
varphi beta - gamma ^2 + (beta^2 + gamma^2 sin^2 alpha }
}
$$
in plain TeX. But you are using LaTeX, so put
newboxtmpbox
defcentereq#1{hbox towdtmpbox{hss$#1$hss}}
before begin{document}
and the code fragment for your equation looks like:
setboxtmpbox=hbox{$beta gamma dot x_3^2 sin x_3
- gamma delta cos x_3 sin x_3 + beta tau_theta $}
begin{equation}
begin{aligned}
dot x_1 &= x_2 cr
dot x_2 &= { beta gamma x_2^2 (sin^2 x_3 - 1) sin x_3 over
varphi beta - gamma^2 + (beta^2 + gamma^2) sin^2 alpha }
&quad - { centereq{2beta^2 x_2 x_4 cos x_3 sin x_3} over
varphi beta - gamma^2 + (beta^2 + gamma^2) sin ^2alpha }
&quad + { copytmpbox over
varphi beta - gamma ^2 + (beta^2 + gamma^2 sin^2 alpha }
end{aligned}
end{equation}
Answered by wipet on February 24, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP