是否可以用数字或文本填充此模板中的所有空白区域?
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass[10pt]{article}
\usepackage[a4paper,pdftex]{geometry} % Use A4 paper margins
\usepackage[english]{babel}
\usepackage{xcolor} % Required for specifying custom colors
\usepackage{fix-cm} % Allows increasing the font size of specific fonts beyond LaTeX default specifications
\setlength{\oddsidemargin}{0mm} % Adjust margins to center the colored title box
\setlength{\evensidemargin}{0mm} % Margins on even pages - only necessary if adding more content to this template
\newcommand{\HRule}[1]{\hfill \rule{0.2\linewidth}{#1}} % Horizontal rule at the bottom of the page, adjust width here
\definecolor{white}{rgb}{255,255,255} % Color of the box surrounding the title - these values can be changed to give the box a different color
\begin{document}
\thispagestyle{empty} % Remove page numbering on this page
%----------------------------------------------------------------------------------------
% TITLE SECTION
%----------------------------------------------------------------------------------------
\colorbox{white}{
\parbox[t]{1.0\linewidth}{
\centering \fontsize{50pt}{80pt}\selectfont % The first argument for fontsize is the font size of the text and the second is the line spacing - you may need to play with these for your particular title
\vspace*{0.7cm} % Space between the start of the title and the top of the grey box
\hfill \LaTeX \\
\hfill Title \\
\hfill Template\par
\vspace*{0.7cm} % Space between the end of the title and the bottom of the grey box
}
}
%----------------------------------------------------------------------------------------
\vfill % Space between the title box and author information
%----------------------------------------------------------------------------------------
% AUTHOR NAME AND INFORMATION SECTION
%----------------------------------------------------------------------------------------
{\centering \large
\hfill John Smith \\
\hfill University Name \\
\hfill Department Name \\
\hfill \texttt{http://www.johnsmith.com} \\
\HRule{1pt}} % Horizontal line, thickness changed here
%----------------------------------------------------------------------------------------
\clearpage % Whitespace to the end of the page
\end{document}
@egreg 如果我手动输入数字,我会得到溢出的水平盒子错误,数字会放在一行中,我无法填充表格。像这样:
\documentclass{article}
\usepackage[a4paper,top=0pt,bottom=0pt,left=1.5pt,right=1.5pt]{geometry}
\input{random}
\def\print{\expandafter\printaux\number\randomi\relax}
\def\printaux#1{\ifx#1\relax\else#1\hskip0pt plus .1pt\relax\expandafter\printaux\fi}
\begin{document}
\baselineskip=12.05pt
\parindent=0pt
\flushbottom
\enlargethispage{20\baselineskip}
5405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054541635454054163545405416354540541635454054163546354540541635454054163545405416354540541635454054163545405416354540546354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354540541635454054163545405416354
\end{document}
答案1
按如下方式编写文档:
\documentclass[10pt]{article}
\usepackage[a4paper]{geometry} % Use A4 paper margins
\usepackage[english]{babel}
\usepackage{xcolor} % Required for specifying custom colors
\usepackage{fix-cm} % Allows increasing the font size of specific fonts beyond LaTeX default specifications
\usepackage{eso-pic,graphicx}
\setlength{\oddsidemargin}{0mm} % Adjust margins to center the colored title box
\setlength{\evensidemargin}{0mm} % Margins on even pages - only necessary if adding more content to this template
\newcommand{\HRule}[1]{\hfill \rule{0.2\linewidth}{#1}} % Horizontal rule at the bottom of the page, adjust width here
\definecolor{white}{RGB}{255,255,255} % Color of the box surrounding the title - these values can be changed to give the box a different color
\begin{document}
\thispagestyle{empty} % Remove page numbering on this page
\AddToShipoutPictureBG*{\includegraphics{fillwithnumbers}}
%----------------------------------------------------------------------------------------
% TITLE SECTION
%----------------------------------------------------------------------------------------
\noindent\colorbox{white}{%
\parbox[t]{\dimexpr\textwidth-2\fboxsep\relax}{
\raggedleft \fontsize{50pt}{80pt}\selectfont % The first argument for fontsize is the font size of the text and the second is the line spacing - you may need to play with these for your particular title
\vspace*{0.7cm} % Space between the start of the title and the top of the grey box
\LaTeX \\
Title \\
Template\par
\vspace*{0.7cm} % Space between the end of the title and the bottom of the grey box
}%
}
%----------------------------------------------------------------------------------------
\vfill % Space between the title box and author information
%----------------------------------------------------------------------------------------
% AUTHOR NAME AND INFORMATION SECTION
%----------------------------------------------------------------------------------------
\hspace*{\fill}\colorbox{white}{\parbox{.5\textwidth}{
\raggedleft\large
John Smith \\
University Name \\
Department Name \\
\texttt{http://www.johnsmith.com} \\
\HRule{1pt}}% Horizontal line, thickness changed here
}
%----------------------------------------------------------------------------------------
\clearpage % Whitespace to the end of the page
\end{document}
还准备一份fillwithnumbers.tex
文件:
\documentclass{article}
\usepackage[a4paper,top=0pt,bottom=0pt,left=1.5pt,right=1.5pt]{geometry}
\input{random}
\def\print{\expandafter\printaux\number\randomi\relax}
\def\printaux#1{\ifx#1\relax\else#1\hskip0pt plus .1pt\relax\expandafter\printaux\fi}
\begin{document}
\baselineskip=12.08039pt
\parindent=0pt
\flushbottom
\enlargethispage{20\baselineskip}
\count255=0
\loop\ifnum\count255<900
\nextrandom\number\print
\advance\count255 1
\repeat
\end{document}
并编译此页。然后标题页将具有填充数字的背景。
Donald Arsenau 编写的文件random.tex
提供了一个易于使用的随机数生成器。每次调用时,都会生成\nextrandom
一个区间 [0,2 31\print
-1] 内的随机数。该宏访问生成的数字(即计数器的值),\randomi
并在任何数字后添加一个小跳跃,以便 TeX 有足够的断点来填充行。我生成尽可能多的数字来填充具有零边距的页面。
计算基线跳过以便可以容纳整数行数,但页面被放大以便最后一行不会太短(PDF 输出无论如何都会被剪切):使用正常设置,可以容纳 70 行,所以我这样做了
(29.7 厘米 - 10pt)/69 = 12.10213pt
(第一行只有 10pt 高),然后将其减小,以便累积差异总计为 1.5pt。
答案2
这是一个基于的解决方案egreg 的回答,适合显示文本。(CW 因为我几乎没有做任何工作,所以功劳归于 egreg。)
主文档保持不变。这是我的文本版本fillwithnumbers.tex
:
\documentclass{article}
\usepackage[a4paper]{geometry}% A4 paper
%\usepackage[letterpaper]{geometry} % letter paper, also change \baselineskip below
\geometry{top=0pt,bottom=0pt,left=1.5pt,right=1.5pt}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}% adapt if using a different language
\usepackage{lmodern}% because Computer Modern's "ß" is ugly.
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{kantlipsum}% for the filler text
\begin{document}\color{gray}
\baselineskip=12.08039pt % A4 paper
%\baselineskip=12.03077pt % letter paper (also change geometry above!)
\parindent=0pt
\flushbottom
\enlargethispage{20\baselineskip}
\kant*[2-11]% replace with the text of your choice, eliminating any paragraph breaks
\end{document}
成品如下:
良好的免费文本来源有: