0

In this answer, someone provides a macro for repeating a string a given number of times. Here's a minimal working example of that macro:

\documentclass{article}

\makeatletter \newcount\my@repeat@count \newcommand{\myrepeat}[2]{% \begingroup \my@repeat@count=\z@ @whilenum\my@repeat@count<#1\do{#2\advance\my@repeat@count@ne}% \endgroup } \makeatother

\begin{document}

\myrepeat{3}{a}

\myrepeat{6}{b}

\myrepeat{9}{c}

\end{document}

enter image description here

I am using this macro to repeat a single character a given number of times. I want to modify the macro so that it repeats the character until the end of the line (the page width might be modified using the geometry package and the macro should still fill the line with the given character).

I know that \textwidth holds the value of the width of the current page, but I don't know how to write a loop that compares the current width against \textwidth in which case it would stop repeating the character.

rdrg109
  • 565

0 Answers0