这是一个简单的例子:
\documentclass[12pt]{letter}
\setlength{\parindent}{15pt}
\signature{Doorknob}
\begin{document}
\begin{letter}{}
\noindent \opening{Dear TeX Stack Exchange,}
Waffles are pancakes with built-in syrup reservoirs.
Unicorns are magically weaponized ponies.
This is a generic paragraph.
\closing{Sincerely,}
\end{letter}
\end{document}
当我尝试查看使用该代码创建的文档时,尽管有该\noindent
命令,但开头的一行(“Dear TeX Stack Exchange”)仍然缩进。
我怎样才能告诉 LaTeX 不要缩进信件的开头行?
答案1
该类建立在零letter
假设之上。\parindent
修补\opening
命令:
\documentclass[12pt]{letter}
\usepackage{showframe} % just for the example
\usepackage{etoolbox}
\patchcmd{\opening}{#1}{\noindent#1}{}{}
\setlength{\parindent}{15pt}
\signature{Doorknob}
\begin{document}
\begin{letter}{Some Body\\
Some Where\\
42 Some Street}
\opening{Dear TeX Stack Exchange,}
Waffles are pancakes with built-in syrup reservoirs.
Unicorns are magically weaponized ponies.
This is a generic paragraph.
\closing{Sincerely,}
\end{letter}
\end{document}
答案2
将该opening
行替换为:
\opening{\noindent Dear TeX Stack Exchange,}