Fraction with longer line
Here's an extended version of \frac
, supporting an optional argument for a wider line:
\documentclass{article}
\DeclareRobustCommand{\frac}[3][0pt]{%
{\begingroup\hspace{#1}#2\hspace{#1}\endgroup\over\hspace{#1}#3\hspace{#1}}}
\begin{document}
\[
\frac{x}{y} \quad \frac[5pt]{x}{y}
\]
\end{document}
Of course you can define your own frac command similar instead of redefining the existing \frac
, also with a default value bigger than 0pt
.
The definition is similar to the definition in amsmath.sty
, except that file is using \@@over
.
Or, you could define your own macro using the original \frac
:
\DeclareRobustCommand{\widefrac}[3][5pt]{%
\frac{\hspace{#1}#2\hspace{#1}}{\hspace{#1}#3\hspace{#1}}}
...
\widefrac{x}{y} ... \widefrac[8pt]{x+y}{y}
In case you really want fractions with a longer line, you can just pad both numerator and denominator with spaces. (Padding the longer of the two would acually suffice.) \frac{\ a\ }{\ b\ }
gives
For a longer line use, e.g., \quad
instead of \
.
\newcommand\bigfrac[2]{%
\begin{array}{c}
#1 \\
\hline
#2
\end{array}}