我定义了一个宏,偶尔在章节开头使用。使用此宏后,我不希望第一个“真实”段落(技术上是第二段)缩进。但是,我只能通过省略宏和第一段之间的任何新行来实现这一点。有没有更优雅的方法?
\documentclass{article}
\begin{document}
\newcommand{\note}[1]{
\begin{flushright}
\textit{#1}
\end{flushright}
}
\section{First section}
First paragraph is correctly NOT indented.
\section{Second section}
\note{My Note}
First `real' paragraph is correctly NOT indented.
\section{Third section}
\note{My Note}
First `real' paragraph should NOT be indented, but IS.
\end{document}
答案1
您可以使用所使用的命令\section
来抑制缩进:
\documentclass{article}
\begin{document}
\makeatletter
\newcommand{\note}[1]{%
\begin{flushright}
\textit{#1}
\end{flushright}\par\@afterindentfalse\@afterheading
}
\makeatother
\section{First section}
First paragraph is correctly NOT indented.
\section{Second section}
\note{My Note}
First `real' paragraph is correctly NOT indented.
\section{Third section}
\note{My Note}
First `real' paragraph should NOT be indented, and ISN'T.
\end{document}