我有同样的问题用点填充页面的剩余部分。也就是说,我想用点填充页面的剩余部分。接受的答案几乎是完美的,但是当我在里面使用它时\begin{enumeration}
,点没有正确缩进。有没有办法让它工作?
我在其他帖子中找到了建议的答案leavevmode
,但无论我将其添加到哪里,它似乎都不起作用。
已编辑:这是我尝试过的代码。我只是leavevmode
在cleaders
上述已接受的答案的顶部添加了它。
% 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}
结果如下:
答案1
您可以使用该linegoal
包来确定点列的宽度。这需要 3 次编译才能确定正确的值。
\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}
至于评论中提出的补充问题。
\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}