6

I am trying to achieve this look: enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
        $\dfrac{2x+7}{x-4}-\dfrac{x+4}{x-2}$
\end{document}
\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\makeatletter
\DeclareFontFamily{U}{tipa}{}
\DeclareFontShape{U}{tipa}{m}{n}{<->tipa10}{}
\newcommand{\arc@char}{{\usefont{U}{tipa}{m}{n}\symbol{62}}}%

\newcommand{\arc}[1]{\mathpalette\arc@arc{#1}}

\newcommand{\arc@arc}[2]{%
    \sbox0{$\m@th#1#2$}%
    \vbox{
        \hbox{\resizebox{\wd0}{\height}{\arc@char}}
        \nointerlineskip
        \box0
    }%
}
\makeatother

\newcommand{\stackAboveArc}[2]{\begin{array}[b]{@{}c@{}}#1\\ \arc{#2}\end{array}}

\begin{document}
    %   $\dfrac{2x+7}{x-4}-\dfrac{x+4}{x-2}$
      $\dfrac{\stackAboveArc{x-2}{2x+7}}{x-4}-\dfrac{\stackAboveArc{x-4}{x+4}}{x-2}$
\end{document}

enter image description here

I don't need any color or font different from the defaults.

EDIT: Well I and modified something which is scaling with the fractions which is great but I can't rotate the arc. How to rotate it? Picture above.

Simeon Simeonov
  • 819
  • 5
  • 11

1 Answers1

8

Here is a proposal that marries your command with this answer by egreg.

\documentclass{article}
\usepackage{amsmath}
\makeatletter% based on https://tex.stackexchange.com/a/260580/121799
\newcommand\underparenonly[1]{%
  \mathop{%
    \vtop{
      \m@th
      \ialign{%
        ##\crcr
        $\hfil\displaystyle{#1}\hfil$\crcr
        \noalign{\kern3\p@\nointerlineskip}%
        \upparenfill\crcr
      }%
    }%
  }
}
\newcommand\upparenfill{%
  $\m@th\setbox\z@\hbox{$\braceld$}%
  \bracelu\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru$%
}
\makeatother
\newcommand{\stackAboveChar}[2]{\begin{array}[b]{@{}c@{}}\underparenonly{#1}\\[1ex]{#2}\end{array}}
\begin{document}
$\stackAboveChar{x-2}{\dfrac{2x+7}{x-4}}-\stackAboveChar{x-4}{\dfrac{x+4}{x-2}}$
\end{document}

enter image description here

As for the code in your question: as you are already using graphicx, you could just add a \rotatebox to flip the parenthesis.

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\makeatletter
\DeclareFontFamily{U}{tipa}{}
\DeclareFontShape{U}{tipa}{m}{n}{<->tipa10}{}
\newcommand{\arc@char}{{\usefont{U}{tipa}{m}{n}\symbol{62}}}%

\newcommand{\arc}[1]{\mathpalette\arc@arc{#1}}

\newcommand{\arc@arc}[2]{%
    \sbox0{$\m@th#1#2$}%
    \vbox{
       \hbox{\resizebox{\wd0}{\height}{\rotatebox[origin=bottom]{180}{\arc@char}}}
        \nointerlineskip
        \box0
    }%
}
\makeatother

\newcommand{\stackAboveArc}[2]{\begin{array}[b]{@{}c@{}}#1\\ \arc{#2}\end{array}}

\begin{document}
    %   $\dfrac{2x+7}{x-4}-\dfrac{x+4}{x-2}$
      $\dfrac{\stackAboveArc{x-2}{2x+7}}{x-4}-\dfrac{\stackAboveArc{x-4}{x+4}}{x-2}$
\end{document}

enter image description here

  • 1
    It's working, but I need thin layer. I found something and updated my code, can you see it? – Simeon Simeonov Feb 04 '19 at 02:05
  • @SimeonSimeonov I rotated the parenthesis of your code. (Yet I must admit that I do not understand all details, not do I know whether or not there is a character code that avoids the rotation, yet since you are loading graphicx anyway that may be not so important.) –  Feb 04 '19 at 02:17
  • Nice. Is it possible to make the gap between the x - 2 and the arc smaller? Negative \vspace{}? – Simeon Simeonov Feb 04 '19 at 11:39
  • @SimeonSimeonov E.g. \newcommand{\stackAboveArc}[2]{\begin{array}[b]{@{}c@{}}#1\\[-0.5ex] \arc{#2}\end{array}}? I.e. add some negative dimension like -0.5ex. If you tell me that's the right dimension, or which dimension you prefer, I will update the answer accordingly. –  Feb 04 '19 at 14:48
  • Sorry for the late response, that's the right dimension i tested it and it looks perfectly. You are great. – Simeon Simeonov Feb 09 '19 at 16:15