KOMA scrbook の「パーツ」のタイトル ページを非表示にする

KOMA scrbook の「パーツ」のタイトル ページを非表示にする

私は、章の見出し用の美しいアートワークと各パートのフルページアートワーク (つまり、パート 1 には「パート 1」というテキストを組み込んだアートワークが使用される) を含む本の組版に取り組んでいます。次の操作で、章の見出しを正常に抑制できました。

\newcommand{\mychapter}[1]{%
  \begingroup
  \let\@makechapterhead\@gobble % make \@makechapterhead do nothing
  \chapter{#1}
  \endgroup
}

(これは動作しますが、Koma は @makechapterhead の再定義について不満を述べています。今のところはそれで問題ありませんが、理想的には Koma を煩わせない解決策が欲しいです。)

しかし、\chapter だけでなく \part でも同じことをしたいのですが、うまくいきません。

ここに、目次とページ スプレッドが適切な MWE を示しますが、「パート 1」のページまたはその反対側の空白ページは印刷したくありません。

\documentclass[twoside,chapterprefix,headings=big]{scrbook}

\usepackage{blindtext}
\usepackage{mwe}


\makeatletter
\newcommand{\mychapter}[1]{%
  \begingroup
  \let\@makechapterhead\@gobble
  \chapter{#1}
  \endgroup
}
\makeatother

\begin{document}
\tableofcontents

\KOMAoptions{headings=openleft}
\part{It begins}
%beautiful artwork goes... around here somewhere?
\includegraphics[width=\textwidth]{example-image-golden}

\KOMAoptions{headings=openright}
\mychapter{a chapter}
 \begin{figure}[t!]
\centering
%beautiful chapter head artwork goes here
\includegraphics[width=\textwidth]{example-image-a}
\end{figure}
\blindtext

\mychapter{another chapter}
 \begin{figure}[t!]
\centering
%beautiful chapter head artwork goes here
\includegraphics[width=\textwidth]{example-image-b}
\end{figure}
\blindtext

\KOMAoptions{headings=openleft}
\part{The middle bit}
%beautiful artwork goes... around here somewhere?
\includegraphics[width=\textwidth]{example-image-golden}

\KOMAoptions{headings=openright}
\mychapter{yet another chapter}
\includegraphics[width=\textwidth]{example-image-c}

\blindtext
\end{document}

(ここでは、「ゴールデン」イメージが、LaTeX が「パート N: タイトル」を出力する代わりに使用されるフルページのアートワークであると仮定しています。)

「パート N: タイトル」のページと、その反対側の空白ページを非表示 (印刷しない) にしたいです。ドキュメントは、目次から 2 ページの見開きに直接進み、左側にパートのアートワーク、右側から章が始まる必要があります。

\mychapter に類似した \newcommand を作成しても、何も実行されず、ログにも何も記録されません。

\makeatletter
\newcommand{\mypart}[1]{%
  \begingroup
  \let\@makeparthead\@gobble
  \part{#1}
  \endgroup
}
\makeatother

偽造しようとする省略するコマンド\part{It Begins}の代わりにToCを

\addcontentsline{toc}{part}{Part \thepart: It Begins}

目次にパート見出しが表示されます下に第 1 章で、部品番号がなく、後続の部品に正しく番号が付けられるように \thepart を増やす方法がわかりません。手動で増やそうとすると、\stepcounter{\thepart}エラーが発生します。

英語版の Koma ガイドでこれがカバーされているとしたら、正直言って私はそれを見逃していました。

皆さんありがとう!

答え1

あなたが何を望んでいるのか、正確にはわかりません。しかし、クラスの内部をいじる代わりに、あなたが望んでいることだけを実行し、それ以外のことは何もしないコマンドを定義することをお勧めします。私の知る限り、あなたが望んでいるのは次のようなものです。

  • 新しい奇数ページ(章の場合)または新しい偶数ページ(部分の場合)を開始します。
  • カウンターを踏む
  • オプションで目次エントリとページヘッダーのマークを追加します
  • 画像を印刷する

\part*TOC エントリとマークにはオプションの引数を使用しています。また、およびと同様に、番号を増やさずに TOC エントリとマークのないスター バリアントも定義しています\chapter*。画像ファイルには必須の引数を使用しています。

\documentclass[chapterprefix,headings=big]{scrbook}

\usepackage{blindtext}
\usepackage{mwe}

\makeatletter
\NewDocumentCommand\ArtPart{som}{%
  \cleardoubleevenpage
  \IfBooleanTF{#1}{% star version: no TOC entry or page header
  }{%
    \refstepcounter{part}%
    \IfValueTF{#2}{% optional argument: Use for TOC entry and page header
      \addparttocentry{\thepart.}{#2}%
      \partmark{#2}%
    }{}%
  }%
  \noindent\includegraphics[width=\textwidth]{#3}%
  \par\nobreak
  \@afterindentfalse% don't indent first paragraph after the heading
  \@afterheading% don't allow page break here etc.
}

\NewDocumentCommand\ArtChapter{som}{%
  \cleardoubleoddpage
  \IfBooleanTF{#1}{% star version: no TOC entry or page header
  }{%
    \refstepcounter{chapter}%
    \IfValueTF{#2}{% optional argument: Use for TOC entry and page header
      \addchaptertocentry{\thechapter}{#2}%
      \chaptermark{#2}%
    }{}%
  }%
  \noindent\includegraphics[width=\textwidth]{#3}%
  \par\nobreak
  \@afterindentfalse% don't indent first paragraph after the heading
  \@afterheading% don't allow page break here etc.
}
\makeatother

\begin{document}
\tableofcontents

\ArtPart[It begins]{example-image-golden}


\ArtChapter[a chapter]{example-image-a}
\blindtext

\ArtChapter[another chapter]{example-image-b}
\blindtext

\ArtPart[The middle bit]{example-image-golden}

\ArtChapter[yet another chapter]{example-image-c}

\blindtext
\end{document}

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

また、 は\thepartカウンターではなく、カウンターの出力であることに注意してください。カウンターは でありpart、したがって、カウンターを操作するには\stepcounter{part}、ではなく、 、 、\refstepcounter{part}\addtocounter{part}{…}使用する必要があります。また、 KOMA スクリプトには定義済みの がないことにご注意ください。\setcounter{part}{…}\stepcounter{\thepart}\@makeparthead

詳細については\NewDocumentCommand「著者のための LaTeX — 最新バージョン」使用される KOMA-Script コマンドの詳細については、KOMA-Script マニュアルを参照してください。

とを本当に使用したい場合は\part、内部コマンドの代わりにと を\chapter再定義する必要があると思います。\chapterlineswithprefixformat\partlineswithprefixformat

\documentclass[chapterprefix,headings=big]{scrbook}

\usepackage{blindtext}
\usepackage{mwe}

\newcommand\mypart[2]{%
  \begingroup
    \KOMAoption{open}{left}%
    \renewcommand*{\partlineswithprefixformat}[3]{%
      \includegraphics[width=\textwidth]{#2}% this is the second argument of
                                % \mypart not of \partlineswithprefixformat
    }%
    \renewcommand*{\partheademptypage}{}% don't add an empty page after \part
    \part[#1]{#2}%
  \endgroup  
}

\newcommand\mychapter[2]{%
  \KOMAoption{open}{right}%
  \DeclareCommandCopy\ChapterLinesWithPrefixFormat\chapterlineswithprefixformat
  \renewcommand*{\chapterlineswithprefixformat}[3]{%
    \includegraphics[width=\textwidth]{#2}% this is the second argument of
                         % \mychapter not of \chapterlineswithprefixformat
  }%
  \chapter[#1]{#2}%
  \DeclareCommandCopy\chapterlineswithprefixformat\ChapterLinesWithPrefixFormat
}

\begin{document}
\tableofcontents

\mypart{It begins}{example-image-golden}


\mychapter{a chapter}{example-image-a}
\blindtext

\mychapter{another chapter}{example-image-b}
\blindtext

\mypart{The middle bit}{example-image-golden}

\mychapter{yet another chapter}{example-image-c}

\blindtext
\end{document}

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

\RedeclareSectionCommandこれを使用すると、たとえば、見出しの前後の垂直距離 = 画像の前後の距離を変更するために使用できます。

ご覧のとおり、この2番目の提案では内部コマンドは必要ありませんでしたが、KOMAスクリプトマニュアルに記載されているユーザーや上級ユーザー向けのコマンド、または「著者のための LaTeX — 最新バージョン」

\begingroup…\endgroup注:では を使用しませんでした。これにより、の後に\mychapterを追加する可能性も失われ、の機能も失われるためです。代わりに、の前にの意味を保存し、 の後に を復元しました。\label\mychapterafterindent=false\RedeclareSectionCommand\chapterlineswithprefixformat\chapter\chapter

最初の提案では、 LaTeX カーネルの と のみが必要でした。これらはクラス/パッケージ作成者にとっては通常のコマンドですが、KOMA スクリプトの内部コマンドではありません\@afterindentfalse\@afterheading

関連情報