[Tex/LaTex] \hrulefill with customized rule

rules

I created a new command to generate doubled rules. How can I use or create a new command similar to \hrulefill in order to force my doubled rules to fill the rest of the line. So far I have tried this but to no avail.

\documentclass{article}

% Configure style for custom doubled line
\newcommand*{\doublerule}{\hrule width \hsize height 1pt \kern 0.5mm \hrule width \hsize height 2pt}

% Configure function to fill line with doubled line
\newcommand\doublerulefill{\leavevmode\leaders\hbox{\doublerule}\hfill\kern\z@}

\begin{document}

\doublerulefill this is a test \doublerulefill

\end{document}

Best Answer

You need to construct a box to give to \leaders eg

enter image description here

\documentclass{article}

% Configure style for custom doubled line
\newcommand*{\doublerule}{\hrule width \hsize height 1pt \kern 0.5mm \hrule width \hsize height 2pt}

% Configure function to fill line with doubled line
\newcommand\doublerulefill{\leavevmode\leaders\vbox{\hrule width .1pt\kern1pt\hrule}\hfill\kern0pt }

\begin{document}

\doublerulefill\ this is a test \doublerulefill

\end{document}
Related Question