1

This question already has an answer here:

I want to fill a line with asterisks just like as with \cdots or \ldots that can be used in tables, \leaders solution doesn't work well.

I'm working in a fixed columns width table, where at the end of the data it is fill with asterisk to denote the end of data.

this what i get inserting asterisks manually and using a command base on \leaders: enter image description here

As is shown in the picture the \leaders way do not fill well the column

marked as duplicate by Werner, yo', Martin Schröder, Jesse, ChrisS Mar 2 '15 at 3:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Can you make an example of use? And where do \leaders fail? – egreg Mar 1 '15 at 23:47
  • "doesn't work well" is not really informative; I added to my answer one example using \leaders inside a table and I didn't see a problem. Add to your question some example code showing the real context in which you need the asteriks and why \leaders fails. – Gonzalo Medina Mar 1 '15 at 23:56
  • 1
    Ah, you should use \hfill and not \hfil. If you constructed a proper MWE, it would have taken 30 seconds to give you this answer. – yo' Mar 2 '15 at 0:12
  • Did you try using the command in my answer? – Gonzalo Medina Mar 2 '15 at 0:48
4

You can use \leaders:

\documentclass{article}

\newcommand\asteriskfill{\leavevmode\xleaders\hbox{$\ast$}\hfill\kern0pt}

\begin{document}

\noindent
\asteriskfill

Some reference text reference text reference text reference text reference text reference text reference text reference text

\end{document}

enter image description here

Using something like

\newcommand\asteriskfill{\leavevmode\xleaders\hbox{$\ast\ $}\hfill\kern0pt}

will space out the asterisks.

Inside a tabular:

\documentclass{article}

\newcommand\asteriskfill{\leavevmode\xleaders\hbox{$\ast\ $}\hfill\kern0pt}

\begin{document}

\noindent
\asteriskfill

Some reference text reference text reference text reference text reference text reference text reference text reference text\par\bigskip

\noindent
\begin{tabular}{p{4cm}p{5cm}}
\hline
column1 & column2 \\
\asteriskfill & \asteriskfill \\
column1 & column2 \\
\asteriskfill & \asteriskfill \\
column1 & column2 \\
\asteriskfill & \asteriskfill \\
\hline
\end{tabular}
\end{document}

enter image description here

  • O.k. thanks your code is almost the same as what i was trying to do : yours $\ast\ $ mine $\ast$ . Yours looks better. But I discover that what really was happening to me is that \leaders seems to does not work well with a package i was loading "colortbl". Afeter i ended loading it all works great – Jared Lo Mar 2 '15 at 0:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.