4

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.)

1
  • How should the a^2 and c items be aligned relative to each other? Both left-aligned, centered, or right-aligned, or something else entirely? Please advise.
    – Mico
    Commented Jul 18, 2015 at 6:40

2 Answers 2

5

If 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} 

enter image description here

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} 

enter image description here

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} 

enter image description here

0
0

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}
1
  • Welcome to TeX.SX! As far as I know, 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.
    – egreg
    Commented Jul 18, 2015 at 5:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .