我正在尝试为信封创建文本。发件人位于左上角,收件人应位于纸张边缘的垂直和水平居中位置。也就是说,发件人的存在不应改变收件人的垂直对齐方式。
\documentclass{letter}
\usepackage[papersize={110mm,220mm},landscape,margin=5mm,twoside=false]{geometry}
\setlength\parskip{0pt}
\pagestyle{empty}
\begin{document}
If undeliverable, please return to:
Joe Citizen
12345 Foo St
Bar BAZ 67890
\huge
RECIPIENT LINE 1
RECIPIENT LINE 2
RECIPIENT LINE 3
\end{document}
RECIPIENT
如何才能使线条相对于整个页面垂直居中?块本身应居中,但其中的文本应左对齐。
答案1
使用center
和\vspace*{\fill}
;对于收件人,最好使用tabular
,以便在相应行中获得左对齐。对于回信地址,使用零高度框。
\documentclass{letter}
\usepackage[
papersize={110mm,220mm},
landscape,
margin=5mm,
twoside=false
]{geometry}
\setlength\parskip{0pt}
\setlength\parindent{0pt}
\setlength\topskip{0pt}
\pagestyle{empty}
\begin{document}
\parbox[t][0pt]{\textwidth}{
\vspace{0pt}% to set the reference point
\raggedright
If undeliverable, please return to:\\
Joe Citizen\\
12345 Foo St\\
Bar BAZ 67890
}
\vspace*{\fill}
\begin{center}
\huge
\begin{tabular}{@{}l@{}}
Joe Citizen\\
12345 Foo St\\
Bar BAZ 67890
\end{tabular}
\end{center}
\vspace*{\fill}
\end{document}
答案2
我会用tikz
这个:
\documentclass{letter}
\usepackage[papersize={110mm,220mm},landscape,margin=5mm,twoside=false]{geometry}
\setlength\parskip{0pt}
\pagestyle{empty}
\usepackage{tikz}
\begin{document}
If undeliverable, please return to:
Joe Citizen
12345 Foo St
Bar BAZ 67890
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center)
{\huge\begin{tabular}{@{}l@{}}
RECIPIENT LINE 1\\
RECIPIENT LINE 21\\
RECIPIENT LINE 3
\end{tabular}};
\end{tikzpicture}
\end{document}