I have split the issue I have into 2 problems and decided to post them at once to avoid semi-duplicate since they are closely related. First is to render all parts of a fraction (including the line) invisible except the numerator (or denominator), retaining position of that numerator. Second is to align a variable of an equation to a numerator of a fraction of another equation using aligned
environment (which I failed to do with &
character).
original code:
\documentclass{standalone}
\usepackage[alignedleftspaceno]{amsmath}
\begin{document}
$%
\begin{aligned}
&\frac{a}{\left(\frac{b}{c}\right)}=x\\
&a=x\cdot\frac{b}{c}
\end{aligned}
$
\end{document}
Problem 1
enclosing entire fraction except numerator (a
) into \phantom
makes numerator (a
) itself disappear along with fraction and distorts alignment
&\frac{a}{\left(\frac{b}{c}\right)}=x\\
&\phantom{\frac{}a\phantom{}{\left(\frac{b}{c}\right)}}=x\cdot\frac{b}{c}
enclosing denominator into \phantom
keeps unwanted fraction-line:
&\frac{a}{\left(\frac{b}{c}\right)}=x\\
&\frac{a}{\phantom{\left(\frac{b}{c}\right)}}=x\cdot\frac{b}{c}
Problem 2
aligning at numerator with &
does not compile:
\frac{&a}{\left(\frac{b}{c}\right)}=x\\
&a=x\cdot\frac{b}{c}
The last piece of code was expected to align second-equation "a" not only horizontally with the first-equation numerator "a" (as shown in the image above) but also properly position it vertically with respect to the "equals" sign.
\genfrac
fromamsmath
but I'm struggling to guess what you want\frac{&a}
to do (even{&a}
would hide the&
from the alignment even if there was no fraction you can not align at arbitrary points in a subterm.