KOMA 스크북에서 "부분"에 대한 제목 페이지를 억제합니다.

KOMA 스크북에서 "부분"에 대한 제목 페이지를 억제합니다.

나는 장 제목에 대한 아름다운 삽화와 각 부분에 대한 전체 페이지 삽화가 있는 책을 조판하는 작업을 하고 있습니다. (그래서 Part 1은 "Part 1"이라는 텍스트를 포함하는 삽화를 얻습니다.) 저는 다음을 사용하여 장 제목을 성공적으로 억제했습니다.

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

(이것은 효과가 있지만 Koma는 @makechapterhead의 재정의에 대해 불평합니다. 지금은 괜찮지만 이상적으로는 Koma를 괴롭히지 않는 솔루션을 원합니다.)

그러나 나는 \part와 \chapter에 동일한 작업을 수행하고 싶지만 이 작업을 수행할 수 없습니다.

다음은 목차와 페이지 스프레드가 올바른 MWE입니다. 그러나 "Part 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}

(우리는 "황금색" 이미지가 "Part N: Title"을 출력하는 LaTeX 대신에 사용되는 전체 페이지 아트워크인 척하고 있습니다.)

"파트 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}오류가 발생합니다.

영어 코마 가이드에서 이런 내용을 다루고 있다면 솔직히 놓쳤습니다.

모두 감사합니다!

답변1

나는 당신이 원하는 것을 정확히 이해하고 있는지 잘 모르겠습니다. 그러나 클래스 내부를 조작하는 대신 원하는 작업만 수행하고 다른 작업은 수행하지 않는 명령을 정의하는 것이 좋습니다. 원하는 AFAIK:

  • 새 홀수 페이지(챕터의 경우) 또는 새 짝수 페이지(부품의 경우)를 시작합니다.
  • 카운터를 밟아
  • 선택적으로 TOC 항목과 페이지 헤더 표시를 추가합니다.
  • 이미지를 인쇄하다

TOC 항목과 표시에 선택적 인수를 사용하고 있습니다. 또한 숫자를 늘리지 않고 TOC 항목을 입력하지 않고 \part*및 유사한 표시를 표시하지 않고 별 변형을 정의하고 있습니다 \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사용해야 하지만 는 사용할 수 없습니다 . KOMA-Script에는 미리 정의된 것이 없다는 점도 참고하세요 .\stepcounter{part}\refstepcounter{part}\addtocounter{part}{…}\setcounter{part}{…}\stepcounter{\thepart}\@makeparthead

에 대한 자세한 내용은\NewDocumentCommand 다음을 참조하세요.“저자를 위한 LaTeX — 최신 버전”. 사용된 KOMA-Script 명령에 대한 자세한 내용은 KOMA-Script 매뉴얼을 참조하세요.

\part정말로 사용 하고 싶고 IMHO가 내부 명령 대신 and를 \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예를 들어 제목 전후 = 이미지 전후의 수직 거리를 변경하는 데 사용할 수 있습니다.

보시다시피, 이 두 번째 제안에는 내부 명령이 필요하지 않고 사용자 또는 고급 사용자를 위해 사용되는 KOMA-Script 매뉴얼에 문서화되어 있거나“저자를 위한 LaTeX — 최신 버전”.

\begingroup…\endgroup참고: 저는 in을 사용하지 않았습니다 . 왜냐하면 이렇게 하면 after를 \mychapter추가할 수 있는 가능성도 중단되고 의 기능 도 중단되기 때문입니다 . 대신 before 의 의미를 저장 하고 after 로 복원했습니다 .\label\mychapterafterindent=false\RedeclareSectionCommand\chapterlineswithprefixformat\chapter\chapter

\@afterindentfalse첫 번째 제안 은 \@afterheadingLaTeX 커널에서만 필요했습니다 . 이는 클래스/패키지 작성자를 위한 일반적인 명령이지만 내부 KOMA 스크립트 명령은 아닙니다.

관련 정보