![次の段落をインデントしない方法は? (`\noindent` はこの段落でのみ機能します)](https://rvso.com/image/420769/%E6%AC%A1%E3%81%AE%E6%AE%B5%E8%90%BD%E3%82%92%E3%82%A4%E3%83%B3%E3%83%87%E3%83%B3%E3%83%88%E3%81%97%E3%81%AA%E3%81%84%E6%96%B9%E6%B3%95%E3%81%AF%3F%20(%60%5Cnoindent%60%20%E3%81%AF%E3%81%93%E3%81%AE%E6%AE%B5%E8%90%BD%E3%81%A7%E3%81%AE%E3%81%BF%E6%A9%9F%E8%83%BD%E3%81%97%E3%81%BE%E3%81%99).png)
日付で始まるセクション タイプのマクロを作成したいと思います。ここまでのところ、次のようになりました。
\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}