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

  • 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 Jul 18 '15 at 6:40
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

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}
  • 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 Jul 18 '15 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.