次の段落をインデントしない方法は? (`\noindent` はこの段落でのみ機能します)

次の段落をインデントしない方法は? (`\noindent` はこの段落でのみ機能します)

日付で始まるセクション タイプのマクロを作成したいと思います。ここまでのところ、次のようになりました。

\documentclass[a5paper, 11pt]{memoir}
\usepackage{ebgaramond}
\usepackage{lipsum}

\setsecheadstyle{\Large\scshape\memRTLraggedright}

\newcommand{\dateSection}[2]{\section*{#1}{\vspace{-1\baselineskip}\hfill \small #2}\noindent}

\begin{document}
\dateSection{Lorem ipsum}{Monday Mars 21}

\lipsum[1-2]
\end{document}

しかし、その後にインデントが入り、\noindent追加しても役に立ちません。

ここに画像の説明を入力してください

マクロでこれを修正するにはどうすればいいでしょうか?

答え1

次の段落がインデント ボックスを消費するように設定します。

\documentclass[a5paper, 11pt]{memoir}
\usepackage{ebgaramond}
\usepackage{lipsum}

\setsecheadstyle{\Large\scshape\memRTLraggedright}

\makeatletter
\newcommand{\dateSection}[2]{%
  \section*{#1}%
  {\vspace{-1\baselineskip}\hfill \small #2\par\nobreak}%
  \@afterindentfalse % don't indent the next paragraph
  \@afterheading % don't break pages too early
}
\makeatother

\begin{document}

\dateSection{Lorem ipsum}{Monday Mars 21}

\lipsum[1-2]

\end{document}

この方法では、コマンドの後に空白行があるかどうかは関係ありません\dateSection

次の段落には、セクションのタイトルと日付とともに少なくとも 2 行が含まれます。

ここに画像の説明を入力してください

答え2

\raiseboxマクロ定義に を追加します。

\documentclass[a5paper, 11pt]{memoir}
\usepackage{ebgaramond}
\usepackage{lipsum}

\setsecheadstyle{\Large\scshape\memRTLraggedright}

\newcommand{\dateSection}[2]{\section*{#1\hfill\raisebox{-0.6\baselineskip}[0pt][0pt]{\upshape\small#2}}}

\begin{document}

\dateSection{Lorem ipsum}{Monday Mars 21}

\lipsum[1-2]

\end{document} 

ここに画像の説明を入力してください

関連情報