매크로를 사용한 후 두 번째 단락을 들여쓰지 않음

매크로를 사용한 후 두 번째 단락을 들여쓰지 않음

섹션 시작 부분에 가끔 사용하는 매크로를 정의했습니다. 이 매크로를 사용한 후에는 첫 번째 '실제' 문단(기술적으로는 두 번째 문단)이 들여쓰기되는 것을 원하지 않습니다. 그러나 매크로와 첫 번째 단락 사이에 새 줄을 생략해야만 이를 달성할 수 있습니다. 더 우아한 방법이 있나요?

\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}

관련 정보