我正在尝试整理一本书,可以将其视为一本带有某些预先填写的条目的周年纪念书。因此每天一页,大多数日子都会有一两个条目。之后,我只想让页面填满行,这样自书印刷以来,有人就可以轻松地来添加新的行。我就是想不出如何做到这一点。我研究了工作原理\dotfill
,但当我尝试摆弄它时它没有帮助,谷歌也没有找到任何结果。有人知道如何做到这一点吗?
需要在 lualatex 中工作。
编辑:受到第一个答案的启发,我现在有了这个,这是我想要的完整但不完整的例子。
\documentclass[12pt, twoside]{book}
\RequirePackage[a5paper,includehead,top=0.5in,inner=0.75in,outer=0.5in,bottom=0.5in]{geometry}
\newsavebox{\thetopstuffbox}
\newlength{\thetopstuffht}
\newcommand\Linepage[1]{%
\vbox to \dimexpr\textheight-#1-2cm\relax {\leaders\hbox to \linewidth{\rule{0pt}{1cm}\hrulefill}\vfil}
}
\usepackage{changepage}
\newcommand{\personentry}[3][3em]{%
\nopagebreak%
\begin{adjustwidth}{#1}{0pt}%
\ignorespaces \hspace{-3em}\textbf{#2} #3
\end{adjustwidth}%
\nopagebreak%
}
\begin{document}
\noindent\sbox{\thetopstuffbox}{%
\noindent\begin{minipage}{\textwidth}
\section*{September 17}
\personentry{Joe Blow}{He did some important stuff and we want to remember him for it. He was a top bloke and did a lot of good work, and we are thankful for it and did I mention everything that he did.}
\personentry{Jane Doe}{Also did a lot of stuff what we really want too remember her for it because if we don't we are going to feel really guiltly about it since I am now just rambling on.}
\end{minipage}%
}\usebox{\thetopstuffbox}\newline\Linepage{\ht\thetopstuffbox}
\pagebreak
\noindent\sbox{\thetopstuffbox}{%
\noindent\begin{minipage}{\textwidth}
\section*{September 18}
\personentry{Joe Blow}{He did some important stuff and we want to remember him for it. He was a top bloke and did a lot of good work, and we are thankful for it and did I mention everything that he did.}
\personentry{Jane Doe}{Also did a lot of stuff what we really want too remember her for it because if we don't we are going to feel really guiltly about it since I am now just rambling on.}
\end{minipage}%
}\usebox{\thetopstuffbox}\newline\Linepage{\ht\thetopstuffbox}
\end{document}
答案1
前段时间,我不得不用问卷调查来解决这类问题。同意 StefanH 的观点,领导者是最好的选择。我认为你需要一个环境来做到这一点:
\documentclass[12pt, twoside]{book}
\usepackage[a5paper,includehead,top=0.5in,inner=0.75in,outer=0.5in,bottom=0.5in]{geometry}
\newcommand\Linepage[1][0.25in]{% Change to suit
\vbox to \dimexpr\textheight-\pagetotal-#1\relax {% Let TeX do the work...
\leaders\hbox to \linewidth{\rule{0pt}{#1}\hrulefill}\vfil
}%
}
\newenvironment{formatpage}[1]{%
\section*{#1}
}{
\Linepage
\pagebreak
}
\newcommand{\personentry}[3][3em]{%
\nopagebreak%
\noindent
\hangindent#1
\textbf{#2\ }#3
\par
\nopagebreak%
}
%% Usage:
%% \begin{formatpage}{<date>}
%% \personentry{<name 1>}{<info>}
%% \personentry{<name 2>}{<info>}
%% ...
%% \end{formatpage}
\begin{document}
\begin{formatpage}{September 17}
\personentry{Joe Blow}{He did some important stuff and we want to remember him for it. He was a top bloke and did a lot of good work, and we are thankful for it and did I mention everything that he did.}
\personentry{Jane Doe}{Also did a lot of stuff what we really want too remember her for it because if we don't we are going to feel really guiltly about it since I am now just rambling on, and on and on and on and on and on\dots}
\end{formatpage}
\begin{formatpage}{September 18}
\personentry{Joe Blow}{He did some important stuff and we want to remember him for it. He was a top bloke and did a lot of good work, and we are thankful for it and did I mention everything that he did.}
\personentry{Jane Doe}{Also did a lot of stuff what we really want too remember her for it because if we don't we are going to feel really guiltly about it since I am now just rambling on.}
\end{formatpage}
\end{document}
答案2
可以用 绘制线条\leaders
,问题是找到页面的结尾。在这里,我先用一天的标题开始,然后用线条填充。线条部分的高度仅为\textheight-10mm
,其中10mm
只是一个适合的数字。如果您更详细地描述标题应包含的内容,那么应该可以将其放在一个框中,然后找到该框的高度。线条之间的距离设置为1cm
。
\documentclass{article}
\newcommand\Linepage[2]{%
\noindent
\begin{minipage}[c]{0.3\linewidth}
\Huge #1
\end{minipage}%
\begin{minipage}[c]{0.7\linewidth}
#2
\end{minipage}\newline
\vbox to \dimexpr\textheight-10mm\relax {\leaders\hbox to \linewidth{\rule{0pt}{1cm}\hrulefill}\vfil}
}
\begin{document}
\Linepage{Sept 17}{Someone is sitting in the shade today because someone planted a tree a long time ago.}
\end{document}