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.

Is there a way to make the fraction line look like the equality (=) sign, i.e., to have two parallel horizontal lines with a little gap in between? Many thanks!

share|improve this question
4  
As a matter of curiosity what does this represent? Disclaimer, mathematically curious but not a mathematician. –  Yiannis Lazarides May 16 '12 at 6:15

1 Answer 1

Use either \Tfrac or \Dfrac (short for Text and Display style "equal fraction") in the following:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\newcommand{\Tfrac}[2]{%
  \ooalign{%
    $\genfrac{}{}{1.2pt}1{#1}{#2}$\cr%
    $\color{white}\genfrac{}{}{.4pt}1{\phantom{#1}}{\phantom{#2}}$}%
}
\newcommand{\Dfrac}[2]{%
  \ooalign{%
    $\genfrac{}{}{1.2pt}0{#1}{#2}$\cr%
    $\color{white}\genfrac{}{}{.4pt}0{\phantom{#1}}{\phantom{#2}}$}%
}
\begin{document}
$f(x)=\Tfrac{1}{2}+\frac{1}{2}$
\end{document}

For a short course on \ooalign, see \subseteq + \circ as a single symbol (“open subset”).


Here is a slightly modified set of commands: \Efrac and \efrac. While both adjust their fraction size based on the math style automatically (using \mathchoice), the former is vertically higher (set based on the height of the two outer black fraction lines) than the latter (set based on the height of a regular fraction).

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\newcommand{\Efrac}[2]{%
  \mathchoice
    {\ooalign{%
      $\genfrac{}{}{1.2pt}0{#1}{#2}$\cr%
      $\color{white}\genfrac{}{}{.4pt}0{\phantom{#1}}{\phantom{#2}}$}}%
    {\ooalign{%
      $\genfrac{}{}{1.2pt}1{#1}{#2}$\cr%
      $\color{white}\genfrac{}{}{.4pt}1{\phantom{#1}}{\phantom{#2}}$}}%
    {\ooalign{%
      $\genfrac{}{}{1.2pt}2{#1}{#2}$\cr%
      $\color{white}\genfrac{}{}{.4pt}2{\phantom{#1}}{\phantom{#2}}$}}%
    {\ooalign{%
      $\genfrac{}{}{1.2pt}3{#1}{#2}$\cr%
      $\color{white}\genfrac{}{}{.4pt}3{\phantom{#1}}{\phantom{#2}}$}}%
}
\newcommand{\efrac}[2]{%
  \mathchoice
    {\ooalign{%
      $\genfrac{}{}{1.2pt}0{\hphantom{#1}}{\hphantom{#2}}$\cr%
      $\color{white}\genfrac{}{}{.4pt}0{\color{black}#1}{\color{black}#2}$}}%
    {\ooalign{%
      $\genfrac{}{}{1.2pt}1{\hphantom{#1}}{\hphantom{#2}}$\cr%
      $\color{white}\genfrac{}{}{.4pt}1{\color{black}#1}{\color{black}#2}$}}%
    {\ooalign{%
      $\genfrac{}{}{1.2pt}2{\hphantom{#1}}{\hphantom{#2}}$\cr%
      $\color{white}\genfrac{}{}{.4pt}2{\color{black}#1}{\color{black}#2}$}}%
    {\ooalign{%
      $\genfrac{}{}{1.2pt}3{\hphantom{#1}}{\hphantom{#2}}$\cr%
      $\color{white}\genfrac{}{}{.4pt}3{\color{black}#1}{\color{black}#2}$}}%
}
\begin{document}
\[ f(x)={\textstyle\Efrac{1}{2}+\frac{1}{2}} \sim \Efrac{3}{4}+\frac{3}{4} \]
\[ f(x)={\textstyle\efrac{1}{2}+\frac{1}{2}} \sim \efrac{3}{4}+\frac{3}{4} \]
\end{document}
share|improve this answer

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.