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