1

I have the same question as Filling remainder of the page with dots. That is, I want to fill the remainder of the page with dots. The accepted answer is almost perfect, but when I use it inside \begin{enumeration}, the dots are not indented properly. Is there a way to get it to work?

I found answers in other posts suggesting that leavevmode would help, but it doesn't appear to work wherever I add it.

Edited: here's the code that I have tried. I simply added leavevmode in front of cleaders on top of the aforementioned accepted answer.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{lipsum}

\makeatletter

\newcommand*\dotcolumnfill{%
    \par
    \null
    \vskip -\ht\strutbox
    \xleaders \hb@xt@ \hsize {%
        \strut \leavevmode \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
    }\vfill
    \vskip \ht\strutbox
    \break
}

\makeatother

\begin{document}

\begin{enumerate}
  \item \lipsum*[1]
  \dotcolumnfill
  \item \lipsum*[2]
\end{enumerate}

\end{document}

Here's the result:

enter image description here

2
  • Please post the code that you have tried.
    – user231225
    Commented Dec 23, 2020 at 4:06
  • I added the code that I tried. Thanks! Commented Dec 23, 2020 at 4:17

2 Answers 2

3

You can use the linegoal package to find out how wide the dot column should be. This requires 3 compilations to settle on the correct value.

\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.
\usepackage{linegoal}
\usepackage{lipsum}

\makeatletter

\newcommand*\dotcolumnfill{%
    \par\noindent\mbox{}\@tempdima=\dimexpr\linewidth-\linegoal
    \null
    \vskip -\ht\strutbox
    \xleaders \hb@xt@ \hsize {%     
        \hspace{\@tempdima}\strut \leavevmode \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
    }\vfill
    \vskip \ht\strutbox
    \break
}

\makeatother
\begin{document}
\makeatletter

\begin{enumerate}
  \item \lipsum*[1]
  \dotcolumnfill
  \item \lipsum*[2]
\end{enumerate}
\lipsum*[3]
\dotcolumnfill
\end{document}

enter image description here

As for the additional question raised in the comments.

\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.
\usepackage{linegoal}
\usepackage{lipsum}

\makeatletter

\newcommand*\dotcolumnfill[1][0]{%
    \par\noindent\mbox{}\@tempdima=\dimexpr\linewidth-\linegoal
    \null
    \vskip -\ht\strutbox
    \ifnum#1=0\relax
    \xleaders \hb@xt@ \hsize {%     
        \hspace{\@tempdima}\strut \leavevmode \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
    }\vfill
    \vskip \ht\strutbox
    \break
    \else
    \@tempcnta=0\relax
    \loop
    \advance\@tempcnta by1\relax
    \hb@xt@ \hsize {%       
        \hspace{\@tempdima}\strut \leavevmode \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
    }%
    \ifnum\@tempcnta<#1\relax
    \repeat
    \fi
}

\makeatother
\begin{document}
\makeatletter

\begin{enumerate}
  \item \lipsum*[1]
  \dotcolumnfill
  \item \lipsum*[2]
  \dotcolumnfill[4]
  \item \lipsum*[3]
\end{enumerate}
\lipsum*[4]
\dotcolumnfill
\end{document}

enter image description here

8
  • If I do not fill all remainder of the page, but, number of line, e.g, 10 lines. How can I do that? Commented Dec 23, 2020 at 6:02
  • @minhthien_2016 I added a second version for that.
    – user231225
    Commented Dec 23, 2020 at 6:13
  • Thanks. When I use \dotcolumnfill[4], I only get three rows with dots. Can I got 4, and \dotcolumnfill[n], I get n rows fill dots. Commented Dec 23, 2020 at 6:16
  • @minhthien_2016 I think you should have gotten 3 but yes, there was a mistake. Now it should work.
    – user231225
    Commented Dec 23, 2020 at 6:19
  • Thanks. Now it is correct. Commented Dec 23, 2020 at 6:21
0

Please check with below macro.

  \makeatletter
        \newcommand*\dotcolumnfill{%
            \par
            \null
            \vskip -\ht\strutbox
            \xleaders \hb@xt@ \hsize {%
                \strut \leavevmode \hphantom{1111l}\cleaders \hb@xt@ .44em{\hss.\hss}\hfill
            }\vfill
            \vskip \ht\strutbox
            \break
        }    
    \makeatother

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .