有没有办法在序言中设置特定大小的 \parbox,然后自动将正文中的文本传递到其中?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\title{ParboxSample}
\author{Truly Rudy??}
\date{January 2015}
\AtBeginDocument{
\parbox[10cm]{\textwidth}{}
}
\begin{document}
\maketitle
\section{Introduction}
\lipsum[0-6]
\end{document}
答案1
用于flowfram
自动切换第一页后的段落有效宽度。(这是对我的答案到你的其它问题。
请注意,您不应flowfram
在未阅读手册的情况下使用它,因为它会对 TeX 的输出程序进行重大修改,因此了解这一点的含义非常重要。
\clearpage
这并不是完全自动的,因为用户需要确保第一个分页符出现在段落之间。不过,用户只需在需要时发出一个即可。
\documentclass[letterpaper]{article}
% Load Packages
\usepackage{geometry}
\geometry{textwidth=6.5in, top=1in, bottom=1in}
\usepackage{xcolor}
\usepackage[demo]{graphicx}
\usepackage[hidelinks]{hyperref}
\usepackage{ifthen}
\usepackage{fancyhdr}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\usepackage{calc,flowfram}
% Define Dark Blue Color, Logo, and Signature Files
\definecolor{XXXblue}{RGB}{0,0,153}
\newcommand\signature{RandomSig}
\newcommand\XXXlogo{example-image-a}
% Define Letterhead Content
\newcommand\dept{A Really Great Place}
\newcommand\deptaddress{A Subdivision of this Place \\
The first address line \\
The second address line \\
The third address line }
\newcommand\deptphone{123-456-7890 \\ Fax: 123-456-7890}
\newcommand\college{A Really Great Place}
\newcommand\eeo{Doing Very Interesting Things}
\newcommand\myname{Random Person \\
Director of Randomness \\
Email: \href{[email protected]} {[email protected]}}
\newcommand\toName{Dear \toName}
\newcommand\toAddress{}
\newcommand\closing{Very Sincerely,}
% Header and Footer
\fancypagestyle{plain}{%
\fancyhead{}%
\renewcommand{\headrulewidth}{0pt}}
% Insert line between paragraphs and don't indent first line
\usepackage{parskip}
\setlength{\parskip}{0.8\baselineskip}
\pagestyle{empty}
\newsavebox{\startletter}
\makeatletter
\AtBeginDocument{%
\sbox{\startletter}{%
\parbox{\linewidth}{%
\@date\bigskip\par
\ifx\toName\@empty\else\toName\par\fi
\ifx\toAddress\@empty\else\toAddress\bigskip\par\fi
\toName\medskip\par}}
\begin{tikzpicture}
[
remember picture, overlay, draw=XXXblue, text=XXXblue, font=\scriptsize, align=left
]
\draw [line width=0.7pt] (current page.north west) +(1.18in,-1.0in) coordinate (c1) -- ($(-0.625in,-1.00in) + (current page.north east)$) coordinate (c2);
\node (h1) [below=of c1, anchor=north west] {\includegraphics[width=2in]{\XXXlogo}};
\node (h2) [right=10mm of h1, anchor=north west] {\deptphone};
\node (h3) [right=10mm of h2.north east, font=\scriptsize\bfseries, anchor=north west] {\dept};
\node (h4) [anchor=north east] at (h3.north -| c2) {\deptaddress};
\node (c3) [above=.5in of c1 |- current page.south, anchor=south west] {\college};
\node [font=\tiny, anchor=south east] at (c3.south -| c2) {\eeo};
\node [below=of h1.south west, anchor=north west, text=black, font=\normalsize] {%
\usebox{\startletter}};
\end{tikzpicture}%
\thispagestyle{empty}}
\makeatother
\AtEndDocument{%
\bigskip\par
\closing\medskip\par
\includegraphics[width=1.5in]{\signature}\par
\myname}
\newflowframe[1]{4.5in}{5in}{1in}{0pt}[firstpagebox]
\newflowframe[>1]{6.5in}{9in}{0pt}{0pt}[otherpagebox]
\usepackage{lipsum}
\def\toName{Some Really Important People}
\def\toAddress{Their Address \\ A place, Somewhere 55555}
\begin{document}
\lipsum[1-2]
\clearpage
\lipsum[3-6]
\end{document}
答案2
您可以按照以下方式进行操作:
在序言中:
\newsavebox\myparbox
\newcommand\setmyparbox[1]{\sbox\myparbox{\parbox[10cm]{\textwidth}{#1}}}
\newcommand\usemyparbox{\usebox{\myparbox}}