How to add space between variables and fraction lines
\genfrac
allows you to customise the rule width, and adding a thin space allows you to control the length as well. The space above and below the rule follows the rule width.
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\newcommand\zfrac[2]{%
\genfrac{}{}{1pt}{0}%
{\mspace{1mu}#1\mspace{1mu}}{\mspace{1mu}#2\mspace{1mu}}}
\begin{document}
\[
\zfrac{\frac{a}{b}}{\frac{c}{d}}
\]
\[
\zfrac{\frac{5}{12}}{\frac{6}{15}}
\]
\end{document}
Here's a solution that uses custom macro called \ddfrac
("double dfrac"), \Bstrut
("bottom strut"), and \Tstrut
("top strut").
\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{mathtools} % for '\cramped' macro
\newcommand\ddfrac[2]{\frac{\displaystyle #1}{\cramped[\displaystyle]{#2}}}
\newcommand\Tstrut{\smash[b]{\strut}}
\newcommand\Bstrut{\smash[t]{\strut}}
\begin{document}
\[
\dfrac{\dfrac{5}{12}}{\dfrac{6}{15}}
\quad\text{vs.}\quad
\ddfrac{\frac{5}{12\Bstrut}}{\frac{6\Tstrut}{15}}
\]
\end{document}