# A "fraction" with three stories and two bars (of equal length)

I'd like to create a document containing "fractions" with three or more stories instead of just two, separated by fraction bars of equal length. (These aren't real fractions, but I want to use fraction bars for the notation.)

Two things I've tried are the matrix environment with \hlines, and simply nesting \fracs. Neither one produces a satisfactory result:

The matrix option, on the left, looks pretty decent, but the \hlines are far too wide; they should be barely wider than each story of the fraction. With the nested \frac option, however, the two bars are of slightly different widths, the entire fraction has incorrect vertical positioning (it's centered on the lower bar, instead of the center story), and the vertical spacing is dubious.

\begin{matrix}
N I \\ \hline
I N \\ \hline
a I
\end{matrix}
= \frac{\dfrac{I a}{\N I}}{I N}


Is there a nice way to get multi-story fractions?

• Welcome to TeX.SX! If these are really fractions this is not a good idea, the notation becomes ambiguous. Sep 19 '14 at 13:35
• Thanks. Indeed, these aren't real fractions; they're something else that I want to use the same notation for. Sep 20 '14 at 20:31

Environment array can be used:

\documentclass{article}

\newcommand*{\threefrac}[3]{%
\begin{array}{@{\,}c@{\,}}%
#1\\
\hline
#2\\
\hline
#3%
\end{array}%
}

\begin{document}
$\threefrac{NI}{IN}{aI} = \threefrac{Ia}{NI}{IN}$
\end{document}


The lines are longer on each sides by a thin space (\,). This can be changed, if the lines should be smaller or larger.

## Uniform spacing around the lines

Here a variant with uniform line spacing using \halign. The vertical space can be configured by redefining \threefracLineSep.

\documentclass{article}

\newcommand*{\threefrac}[3]{%
\ensuremath{%
\vcenter{%
\halign{\hfil$\,##\,$\hfil\cr
#1\cr
\noalign{\kern\threefracLineSep}%
\hline
\noalign{\kern\threefracLineSep}%
#2\cr
\noalign{\kern\threefracLineSep}%
\hline
\noalign{\kern\threefracLineSep}%
#3\cr
}%
}%
}%
}
\newcommand*{\threefracLineSep}{.4ex}

\begin{document}
$\threefrac{NI}{IN}{aI} = \threefrac{Ia}{NI}{IN} \neq \threefrac{\sum\limits_{n=1}^\infty NI^n}{\dots}{n}$
\end{document}


• i think these would look nicer with uniform vertical spacing around the rules. (i still wouldn't have any idea what is meant.) a zero-width vertical element could be defined to add a bit more height on the two bottom rows, the amount of height requiring experimentation. this wouldn't interact with superscripts if they occur, unlike an added skip with \\[...]. subscripts are probably already accommodated by the implicit descenders. Sep 19 '14 at 15:07
• @barbarabeeton I have added a variant with uniform spacing around the rules. Sep 19 '14 at 15:20
• nice! (i hadn't thought of the "degenerate" case you show on the right.) even though you'll probably get grumbles about "descending" into non-latex code. Sep 19 '14 at 15:30