如何讓下一段不縮排? (`\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

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

在此輸入影像描述

相關內容