Fractions increasing spacing above and below fraction line (vinculum) and make more bold

fractionsspacing

I'd like to increase spacing between fraction line and numbers (numerator, denominator, and make the fraction more bold. I want same line thickness. One solution I've got from the website increases the line thickness too much, but does move the numbers down and up. Also, how can the fraction line length be increased?

\documentclass[12pt,addpoints]{exam}
\usepackage{amsmath}

%************needed for fraction line
\def\oover{\abovewithdelims..0.2cm}
%**********************

%*********needed to make change font size
\makeatletter
\newcommand\HUGE{\@setfontsize\Huge{40}{60}}
\makeatother   
%*****************
\def\mathLarge#1{\mbox{\LARGE $#1$}}


\begin{document}

\hfill { \textbf{Mark:  {{\HUGE  $ 12 \oover 40 $}}   }
    
 \bf{{   \HUGE  $ \genfrac {}{} {1.5pt}{}   {a} {40}$}} 
  
    
\end{document}

Best Answer

I don't know if I understood you correctly, but here \myfrac allows you to set both thickness and length and distance from the fractional line as you wish.

     \documentclass[12pt,addpoints]{exam}
        \usepackage{amsmath}        
        \newcommand\myfrac[2]{\genfrac{}{}{2pt}{0}{#1}{\hspace*{10pt}#2\hspace*{10pt}}}
        
   \begin{document}
        \Huge 
        $A\genfrac{}{}{3pt}{0}{ a}{\hspace*{1cm}40\hspace*{1cm}}\cdot
        \myfrac{a}{b}\cdot
        \genfrac{}{}{3pt}{1}{ a}{40}$
        $\myfrac{a}{40}$        
    \end{document}

enter image description here

Addendum.

You might want to use tikz. You can adjust the parameters as you see fit. Note that the effects depend on the size of the font. Also, a line that is too thick (>2pt) greatly increases the distance to the fractional line.

If you go in to see how tikz works in this case, you can replace the \path command with \draw.

\documentclass[12pt,addpoints]{exam}
        \usepackage{amsmath}
        \usepackage{tikz}

        \newcommand\myfrac[5]{%
            \genfrac{}{}{#1}{0}{%            
            \begin{tikzpicture}[baseline=0pt]
                \path[line width=0pt] (0,0) -- (0,#3) -- (#2,#3) -- (#2,0) -- (0,0);%
                \node at (#2/2, #3/2) {$#4$};%
            \end{tikzpicture}}
            {%
            \begin{tikzpicture}[baseline=-#3-#1]
                \path[line width=0pt] (0,0) -- (0,#3) -- (#2,#3) -- (#2,0) -- (0,0);%
                \node at (#2/2, #3/2) {$#5$};%
            \end{tikzpicture}}
            }
            
        \begin{document}
        \Huge
        
        % the thickness of the fractional line
       $$\myfrac{0.2pt}{0pt}{0pt}{a}{b}\cdot
         \myfrac{1pt}{0pt}{0pt}{a}{b}\cdot
         \myfrac{2pt}{0pt}{0pt}{a}{b}\cdot
         \myfrac{4pt}{0pt}{0pt}{a}{b}$$

        % the length of the fractional line
       $$\myfrac{1pt}{20pt}{0pt}{a}{b}\cdot
         \myfrac{1pt}{40pt}{0pt}{a}{b}\cdot
         \myfrac{1pt}{60pt}{0pt}{a}{b}\cdot
         \myfrac{1pt}{80pt}{0pt}{a}{b}$$

        % the distance between the fractional line and the numbers
       $$\myfrac{1pt}{0pt}{0pt}{a}{b}\cdot
         \myfrac{1pt}{0pt}{40pt}{a}{b}\cdot
         \myfrac{1pt}{0pt}{60pt}{a}{b}\cdot
         \myfrac{1pt}{0pt}{90pt}{a}{b}$$

    \end{document} 

enter image description here

Note.

As for the distance from the fractional line according to @barbara beeton - this is a TeX error. See her comment to answer.