Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to display some axioms and operational rules with LaTeX.

Those are basically . They work quite well when used with frac, but it's not really nice, I'd like the fraction line to be a bit longer.

I know that sounds a bit vague, so here is a picture of what I am trying to achieve. I'm pretty sure that document has been typeset in LaTeX, so it should be doable. Photo of what I am trying to achieve

share|improve this question

4 Answers 4

up vote 5 down vote accepted
\newcommand\bigfrac[2]{%
  \begin{array}{c}
    #1 \\
    \hline
    #2
  \end{array}}
share|improve this answer
    
Thanks. I wanted to give it a little more space under the line (the letters over the arrows now almost touch it) so I tried: \newcommand\bigfrac[2]{\begin{array}{c}#1\\\hline\vspace{1pt}#2\end{array}} but that just increased the space between the two lines in the picture. –  Tim van Dalen Jun 25 '11 at 12:55
2  
Add \begingroup\setlength\extrarowheight{1pt} before \begin{array} and \endgroup after \end{array}. Load the array package. –  egreg Jun 25 '11 at 12:59
    
Thanks, looks great –  Tim van Dalen Jun 25 '11 at 13:06

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}

enter image description here

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}
share|improve this answer
3  
Note that the use of \over together with amsmath will lead to Package amsmath Warning: Foreign command \over. –  Hendrik Vogt Jun 25 '11 at 13:23
2  
With amsmath the command \@@over can be used instead, exactly in the same way plus \makeatletter and \makeatother. amsmathdefines: \@saveprimitive\over\@@over. –  Stefan Kottwitz Jun 25 '11 at 13:26
    
Why not restore the old \frac and use it here? Or use \genfrac provided by amsmath. –  Leo Liu Jun 25 '11 at 17:25
1  
@Leo: added an example re-using \frac. Of course it could be done similar with \genfrac. –  Stefan Kottwitz Jun 25 '11 at 17:51

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

share|improve this answer
    
OK, Stefan just posted a better version of this. –  Hendrik Vogt Jun 25 '11 at 13:21

You should consider to use a dedicated package to write your axioms; the bussproofs package could be an option:

\documentclass{article}
\usepackage{bussproofs}
\usepackage{amsmath}

\newcommand*\LArrow[1][a]{\xrightarrow{\phantom{a}#1\phantom{a}}}

\begin{document}

\begin{prooftree}
  \AxiomC{$x\LArrow x^\prime$}
  \UnaryInfC{$x+y\LArrow x^\prime$}
\end{prooftree}

\end{document}

enter image description here

To work with displayed math environments, a better option would be to use the proof package. A little example:

\documentclass{article}
\usepackage{proof}
\usepackage{amsmath}

\newcommand*\PA{\phantom{a}}
\newcommand*\LArrow[1][a]{\xrightarrow{\PA#1\PA}}

\begin{document}

\begin{equation}
  \infer{\PA x+y\LArrow x^\prime\PA}{x\LArrow x^\prime}
  \qquad
  \infer{\PA x+y\LArrow y^\prime\PA}{y\LArrow y^\prime}
  \qquad
  \infer{\PA x+y\, \downarrow\PA}{x\,\downarrow}
  \qquad
  \infer{\PA x+y\, \downarrow\PA}{y\,\downarrow}
\end{equation}

\end{document}

enter image description here

share|improve this answer
    
Looks better, but I don't need more functionality than the answer above provided. Plus, I can't get it to work in a displaymath environment. –  Tim van Dalen Jun 25 '11 at 13:04
    
Interesting ! a discover for me –  Alain Matthes Jun 25 '11 at 13:06
    
@Tim van Dalen: see my updated answer. –  Gonzalo Medina Jun 25 '11 at 13:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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