1

I am not sure if this counts as a duplicate question, but I would like to have a fraction where the delimiter consists of two lines. I tried using the Tfrac solution at Fraction with doubled line and it works fine, until I use an ams environment in the denominator and get the following output

enter image description here

I assume it is related to the usage of ooalign. I tried to look up online how I should go about this, but I can't seem to find much.

My code is

\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}}$}% }

$ \Tfrac { \phantom{test} } { \mathtt{B} \oplus {\mathit{repeat}:, \mathtt{B?[int]; S'}} , \leq , \mathtt{B \oplus} \left{ \begin{aligned} & \mathit{notify} : \mathtt{B![bool]; end} \ & \mathit{repeat}: S_4 \ & \mathit{stop}: \mathtt{end} \ \end{aligned} \right} } $

Edit: To show the intended use, I would like to end up with something like this, but with double lined fractions instead.

enter image description here

Filu
  • 25
  • Is there something above the two lines? – egreg Dec 29 '23 at 14:42
  • From your example it looks more like you want a double accent bar. – mickep Dec 29 '23 at 14:45
  • In this example no, however there will be cases where I will also have these type of fractions as the numerator. The end result would be a derivation tree, so I would ideally need to be able to nest these fractions, which I currently can, as long as I don't use the ams environment – Filu Dec 29 '23 at 14:46
  • @Filu I believe you're using the wrong tool. – egreg Dec 29 '23 at 14:47
  • @egreg could you please guide me in the right direction? I will also add an example of how I would like to use it later on, to maybe give a better explanation of what I mean by nested – Filu Dec 29 '23 at 14:52
  • 2
    @Filu There are several packages to display derivations. – egreg Dec 29 '23 at 15:01
  • @egreg thank you for suggesting this, I found the ebproof package and it seems much more suited for what I want to achieve – Filu Dec 29 '23 at 15:13

1 Answers1

2

I think that you're using the wrong tool. Anyway, a simple modification of my code in another answer to the question you link to will do.

\documentclass{article}
\usepackage{amsmath}

\makeatletter \newlength{\doublefracgap} \setlength{\doublefracgap}{0.75pt} \DeclareRobustCommand{\doublefrac}[2]{% \mathinner{\mathpalette\doublefrac@{{#1}{#2}}}% } \newcommand{\doublefrac@}[2]{\doublefrac@@#1#2} \newcommand{\doublefrac@@}[3]{% \ooalign{% \raisebox{\doublefracgap}{\normalbaselines$\m@th#1\frac{#2}{\phantom{#3}}$}\cr \raisebox{-\doublefracgap}{\normalbaselines$\m@th#1\frac{\phantom{#2}}{#3}$}\cr }% } \newcommand{\ddoublefrac}[2]{{\displaystyle\doublefrac{#1}{#2}}} \newcommand{\tdoublefrac}[2]{{\textstyle\doublefrac{#1}{#2}}} \makeatother

\begin{document}

[ \doublefrac { \phantom{test} } { \mathtt{B} \oplus {\mathit{repeat}:, \mathtt{B?[int]; S'}} , \leq , \mathtt{B} \oplus \left{ \begin{aligned} & \mathit{notify} : \mathtt{B![bool]; end} \ & \mathit{repeat}: S_4 \ & \mathit{stop}: \mathtt{end} \ \end{aligned} \right} } ]

\end{document}

The difference is in the \normalbaselines declarations.

I fixed \mathtt{B\oplus} to \mathtt{B}\oplus, as the former is wrong as it produces wrong spacing (and \mathtt around \oplus does nothing at all).

enter image description here

egreg
  • 1,121,712