How do I align the numerator and denominator of a fraction? I am looking for something that achieves the following psuedocode:
\frac{a^2 & b}{c & d}
(The b and d should be aligned vertically on top of one another.)
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityIf you also want a
on top of c
, you can simply add a \hfill
between c
and d
.
MWE:
\documentclass{article}
\begin{document}
\[
\frac{a^2 b}{c\hfill d}
\]
\end{document}
If, instead, you want a^2
on top of c
, also add a \hfill
before c
:
MWE:
\documentclass{article}
\newlength\mylength
\settowidth\mylength{$a^2$}
\begin{document}
\[
\frac{a^2 b}{\hfill c\hfill d}
\]
\end{document}
Here's a last possibility, but I don't think it is what you are looking for.
\documentclass{article}
\newlength\mylength
\settowidth\mylength{$a^2$}
\begin{document}
\[
\frac{a^2 b}{\hfill c d}
\]
\end{document}
You can get this with mathpartir
package. You can use \inferrule
for typesetting logical inference rules.
\documentclass{article}
\usepackage{mathpartir}
\begin{document}
\inferrule{a \\ b}{c \\ d}
\end{document}
mathpartir.sty
is not on CTAN, so a pointer to it would make for a better answer. Another minor point: the minimal
class should not be used for examples; better using article
.
a^2
andc
items be aligned relative to each other? Both left-aligned, centered, or right-aligned, or something else entirely? Please advise.