Here is my attempt, which uses \ooalign
and \genfrac
in the definition:
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand\dotover{\leavevmode\cleaders\hb@xt@ .22em{\hss $\cdot$\hss}\hfill\kern\z@}
\newcommand{\dotfrac}[2]{
\ooalign{$\genfrac{}{}{0pt}{0}{#1}{#2}$\cr\dotover\cr}
}
\makeatother
\begin{document}
\[\varphi=\dfrac{1+\sqrt5}{2}\neq\dotfrac{1+\sqrt5}{2}\]
\end{document}
Result:
Update
Now with \mathchoice
for different size!
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\dotfrac}[2]{
\mathchoice
{\ooalign{$\genfrac{}{}{0pt}{0}{#1}{#2}$\cr\leavevmode\cleaders\hb@xt@ .22em{\hss $\displaystyle\cdot$\hss}\hfill\kern\z@\cr}}
{\ooalign{$\genfrac{}{}{0pt}{1}{#1}{#2}$\cr\leavevmode\cleaders\hb@xt@ .22em{\hss $\textstyle\cdot$\hss}\hfill\kern\z@\cr}}
{\ooalign{$\genfrac{}{}{0pt}{2}{#1}{#2}$\cr\leavevmode\cleaders\hb@xt@ .22em{\hss $\scriptstyle\cdot$\hss}\hfill\kern\z@\cr}}
{\ooalign{$\genfrac{}{}{0pt}{3}{#1}{#2}$\cr\leavevmode\cleaders\hb@xt@ .22em{\hss $\scriptscriptstyle\cdot$\hss}\hfill\kern\z@\cr}}
}
\makeatother
\begin{document}
Display:
\[\varphi=\frac{1+\sqrt5}{2}\neq\dotfrac{1+\sqrt5}{2}\]
Text:
\[\textstyle\varphi=\frac{1+\sqrt5}{2}\neq\dotfrac{1+\sqrt5}{2}\]
Script:
\[_{\varphi=\frac{1+\sqrt5}{2}\neq\dotfrac{1+\sqrt5}{2}}\]
Scriptscript:
\[_{_{\varphi=\frac{1+\sqrt5}{2}\neq\dotfrac{1+\sqrt5}{2}}}\]
\end{document}
Result:
The easy answer would be to just use \contentsline
, since you probably want to copy the look of the other "list of x"es:
\contentsline{figure}{\numberline{3.2.1}Verfügbarkeit}{x}
The first parameter would be the entry type you want it to look like, for example section
or chapter
.
However, you could also automate the creation of your custom list of ..., which may be more maintainable in the long run.
One can also dig down into the definitons of the macros to find the magic that happens inside:
\show\contentsline
% results in #1->\csname l@#1\endcsname
So we see that the first parameter is used to complete a macro name, so let's see how this one expands:
\makeatletter
\show\l@figure
% results in ->\@dottedtocline {1}{1.5em}{2.3em}
Getting closer...
\show\@dottedtocline
% results in #1#2#3#4#5->\ifnum #1>\c@tocdepth \else \vskip \z@ \@plus .2\p@ {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip \parindent #2\relax \@afterindenttrue \interlinepenalty \@M \leavevmode \@tempdima #3\relax \advance \leftskip \@tempdima \null \nobreak \hskip -\leftskip {#4}\nobreak \leaders \hbox {$\m@th \mkern \@dotsep mu\hbox {.}\mkern \@dotsep mu$}\hfill \nobreak \hb@xt@ \@pnumwidth {\hfil \normalfont \normalcolor #5}\par }\fi
Ok, this is getting messy. But knowing that \leaders
is responsible, we can isolate the interesting part of this command:
\leaders\hbox{$\m@th\mkern\@dotsepmu\hbox{.}\mkern\@dotsepmu$}\hfill
So if you want just the lines, but want them to look exactly like the tableofcontents ones, you could wrap this into a macro.
Best Answer
Heavily based on https://tex.stackexchange.com/a/27260/36296
While the above solution is sensitive to the decent of the words to be underlined (e.g. if there are letters such as
j
in the words), the following will place the lines at the same position, regardless the characters.