サブサブセクションのタイトルの後にピリオド/ドットを追加する

サブサブセクションのタイトルの後にピリオド/ドットを追加する

に似ているセクションの後にピリオドを追加する. でもKOMAを使っているので使えませんtitlesec

ちなみに、APA スタイル ガイドを使用します。

MWE:

\documentclass[a4paper, oneside, 12pt, parskip=half]{scrartcl}

\usepackage{lipsum}

% --- APA Style --- %

% For spacing
\usepackage{setspace}
\doublespacing

\setlength{\parindent}{0.5in}
\usepackage{indentfirst} % Indent even the 1st paragraph after each section header.

\addtokomafont{section}{\centering}
\RedeclareSectionCommand[afterskip=-1em, indent=0.5in]{subsubsection}

% --- End of APA Style --- %

\usepackage{lipsum}

\begin{document}

\tableofcontents

\clearpage

\section{This should be centered}

\lipsum[1]

\subsection{This is same as default for KOMA}

\lipsum[2]

\subsubsection[Runin, and need a dot after this title]{Runin, and need a dot after this title.}

Without resorting to using a separate `short title` without period at the end, and a `title` with the ending period, I hope to do just:

\subsubsection{Have dot at end}

\lipsum[3]

\end{document}

答え1

\sectioncatchphraseformatサブサブセクションが実行中のヘッダーである場合は、サブサブセクションのタイトル テキストの後にドットを挿入するように再定義する必要があります。

\documentclass[a4paper, oneside, 12pt, parskip=half]{scrartcl}
% --- APA Style --- %
\usepackage{setspace}
\doublespacing
\setlength{\parindent}{0.5in}

\RedeclareSectionCommand[beforeskip=3.5ex plus 1ex minus .2ex]{section}
\RedeclareSectionCommand[beforeskip=3.25ex plus 1ex minus .2ex]{subsection}
\RedeclareSectionCommand[afterskip=-1em, indent=\the\parindent]{subsubsection}

\makeatletter
\renewcommand{\sectionlinesformat}[4]{%
  \ifstr{#1}{section}{\centering}{}% center section titles
  \@hangfrom{\hskip #2#3}{#4}%
}
\makeatother
\renewcommand{\sectioncatchphraseformat}[4]{%
  \hskip #2#3#4%
  \ifstr{#1}{subsubsection}{.}{}% dot after subsection titles
}
% --- End of APA Style --- %

\usepackage{lipsum}% only for dummy text

\begin{document}
\tableofcontents
\clearpage
\section{This should be centered}
\lipsum[1]
\subsection{This is same as default for KOMA}
\lipsum[2]
\subsubsection{Runin, and need a dot after this title}
Without resorting to using a separate `short title` without period at the end, and a `title` with the ending period, I hope to do just:
\subsubsection{Have dot at end}
\lipsum[3]
\end{document}

\documentclass{scrbook}

\renewcommand{\thechapter}{\Roman{chapter}}

\usepackage[usedvipsnames]{xcolor}
\usepackage{romanbar}
\RedeclareSectionCommand[
  tocentrynumberformat=\def\autodot{}\textcolor{red}
]{chapter}

\usepackage{xpatch}
\xpatchcmd{\addchaptertocentry}
  {\addtocentrydefault{chapter}{#1}{#2}}
  {\ifstr{#1}{}{\addtocentrydefault{chapter}{#1}{#2}}
    {\addtocentrydefault{chapter}{\protect\Romanbar{#1}}{#2}}%
  }{}{\PatchFailed}

\usepackage{lipsum}

\begin{document}
\tableofcontents

\chapter{First Chapter}
\lipsum[2]
\chapter{Second Chapter}
\lipsum[2]
\chapter{Third Chapter}
\lipsum[2]
\end{document}

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

すべての runin 見出しの末尾にドットを付ける場合は、次のようにします。

\renewcommand{\sectioncatchphraseformat}[4]{\hskip #2#3#4.}

追加コメント:

sectionセクションの見出しを中央揃えするためにフォント要素を誤用しないでください。\sectionlinesformat代わりに再定義してください。パッケージをロードする必要はありませんindentfirst

答え2

\subsubsectionこれは、(再宣言するため機能しない)以外のすべてに対する部分的な解決策です。マクロは\sectionlinesformat自動的にドットを追加します。

このマクロのドキュメント (scrguide/scrguien) は、セクション 21 (ドイツ語ガイドの 508 ページ、英語ガイドの 461 ページ) にあります。これは、KOMA がセクションをカスタマイズするために使用するマクロの 1 つです (titlesec のメカニズムの代わりに)。

駒

\documentclass[a4paper, oneside, 12pt, parskip=half]{scrartcl}

\usepackage{lipsum}

% --- APA Style --- %

% For spacing
\usepackage{setspace}
\doublespacing

\setlength{\parindent}{0.5in}
\usepackage{indentfirst} % Indent even the 1st paragraph after each section header.

\addtokomafont{section}{\centering}
\RedeclareSectionCommand[afterskip=-1em, indent=0.5in]{subsubsection}

\makeatletter
\renewcommand\sectionlinesformat[4]{%
  \@hangfrom{\hskip#2 #3}{#4.}
}
\makeatother

\begin{document}
\tableofcontents

\clearpage

\section{This should be centered}

\lipsum[1]

\subsection{This is same as default for KOMA}

\lipsum[2]

\subsubsection[Runin, and need a dot after this title]{Runin, and need a dot after this title.}

Without resorting to using a separate `short title` without period at the end, and a `title` with the ending period, I hope to do just:

\subsubsection{Have dot at end}

\lipsum[3]

\end{document}

関連情報