前にスペースを入れずに、memoir の section* コマンドを正確に模倣する新しいコマンドを作成しますか?

前にスペースを入れずに、memoir の section* コマンドを正確に模倣する新しいコマンドを作成しますか?

memoir現在、このコマンドを使用しており\section*、一部のケースではコマンドの前にスペースが必要ない場合を除いて、必要な操作はすべて実行されています。

\documentclass[12pt]{memoir}
\begin{document}
\section{No Space, top of page}
\section*{Space}
\section*{No space above here, please}
\end{document}

間隔を空けた例

\qrr*先頭にスペースがない、似たような新しいコマンドを作成するにはどうすればよいでしょうか。他のコマンドやコマンド\section*の書式を誤って変更したくありません。\section\section*

答え1

これがあなたが望んでいることかどうかはわかりませんが、質問へのコメントに基づいて、私はこの答えを提供します。次のように\qrr定義されます(唯一の変更は、見出しの前のスペースとレベルです)。\sectionmemoir.cls0pt6

\documentclass{memoir}
\usepackage{lipsum}
\usepackage{mdframed}

\makeatletter
\newcommand{\qrr}{%
  \sechook%
  \@startsection{section}{6}%  level 1
      {\secindent}%            heading indent
      {0pt}%        skip before the heading
      {\aftersecskip}%         skip after the heading
      {\normalfont\secheadstyle}} % font
\makeatother

\begin{document}
\section{No Space, top of page}
\lipsum[4]
\section*{Space}
\lipsum[4]
\begin{mdframed}
\qrr*{No space above here, please}
\lipsum[4]
\end{mdframed}

\end{document}

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

関連情報