저는 LaTeX로 강의 노트를 작성하고 있는데 제가 다니고 있는 대학의 기업 디자인 가이드에 명시된 몇 가지 형식 지정 지침을 따르고 싶습니다. 특히 제목 페이지와 각 페이지의 시작 부분에 삽입되는 페이지를 설정하고 싶습니다.부분아주 구체적인 방법으로요. 그렇게 하기 위해 저는 TikZ와 TikZ 라이브러리를 사용하여 calc
이 페이지의 개별 부분을 올바르게 배치하고 있습니다.
% TEXTBOX
제가 직면하고 있는 문제는 다음과 같습니다. 아래 MWE에 라벨을 붙인 것의 위치는 % (SUB-)HEADLINE
MWE에 라벨을 붙인 것의 상단/하단을 기준으로 합니다. 내 제목 페이지에서는 완벽하게 작동합니다. 이는 구성 요소 의 텍스트를 둘러싸는 상자가 % (SUB-)HEADLINE
실제 텍스트 바로 위와 아래에서 시작하고 끝나는 것을 의미합니다. 그러나 각 부분의 시작 부분에 있는 명령에 의해 소개된 페이지의 경우 페이지 부분의 \part{...}
텍스트 위와 아래에 추가 공간이 있는 것 같습니다 . % HEADLINE
이 공간 크기는 명령의 두 번째 인수를 조작함에 따라 변경되며 \fontsize{}{}
, 부분 제목이 한 줄에 걸쳐 있는지 아니면 두 줄에 걸쳐 있는지(MWE에 표시된 대로)에 따라 동작이 달라집니다. 명령 에서 선택한 값은 \fontsize
임의적이지 않고 내가 따르려는 스타일 지침에 고정되어 있습니다. 따라서 가능하다면 이를 변경하지 않는 것이 좋습니다.
나는 이 문제에 대한 답을 찾기 위해 꽤 많은 시간을 보냈고 다음 명령을 발견했습니다.
partheadstartvskip
partheadendvskip
RedeclareSectionCommand[...]{part}
옵션/매개변수와 함께beforeskip
,afterskip
,innerskip
하지만 이것을 사용해도 디스플레이의 추가 공간을 없앨 수는 없었습니다.부분내 제목 페이지에 없는 페이지입니다.
이에 대한 도움을 주시면 대단히 감사하겠습니다!
\documentclass[paper=a4, fontsize=11pt]{scrbook}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{setspace}
% MODIFY APPEARANCE OF PART PAGES
\renewcommand\partformat{%
\fontsize{12pt}{14pt}\selectfont%
\partname~\thepart%
}
\setkomafont{part}{\fontsize{24pt}{34pt}\selectfont}
\renewcommand\partlineswithprefixformat[3]{%
\thispagestyle{empty}%
\begin{tikzpicture}[remember picture, overlay]
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (headline) at ($(current page.south west) + (16mm, 72mm)$) {#3};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (subheadline) at ($(headline.north west) + (0, 16mm)$) {#2};
% BACKGROUND
\fill[lightgray] ($(current page.north west) + (8mm, -38mm)$) rectangle ($(current page.east |- subheadline.north) + (0, 16mm)$);
% TEXTBOX
\fill[gray, fill opacity=0.9] ($(current page.west |- subheadline.north) + (0mm, 32mm)$) rectangle ($(current page.west |- headline.south) + (154mm, -16mm)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (headline.south west) {#3};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (subheadline.south west) {#2};
\end{tikzpicture}
}
\begin{document}
\sffamily
\onehalfspacing
% TITLE PAGE
\begin{titlepage}
\begin{tikzpicture}[remember picture, overlay]
% BACKGROUND
\fill[lightgray] ($(current page.north west) + (8mm, -38mm)$) rectangle ($(current page.south east)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (headline) at ($(current page.south west) + (16mm, 32mm)$) {\fontsize{24pt}{34pt}\selectfont \sffamily\bfseries Quantitative Foundations of \\ Artificial Intelligence \par};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (subheadline) at ($(headline.north west) + (0, 8mm)$) {\fontsize{12pt}{14pt}\selectfont \sffamily\bfseries Name of University \textbar{} Winter 2023/24 \par};
% TEXTBOX
\fill[gray, fill opacity=0.9] ($(current page.west |- subheadline.north) + (0mm, 16mm)$) rectangle ($(current page.south west) + (154mm, 16mm)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (headline.south west) {\fontsize{24pt}{34pt}\selectfont \bfseries Quantitative Foundations of \\ Artificial Intelligence \par};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (subheadline.south west) {\fontsize{12pt}{14pt}\selectfont \bfseries Name of University \textbar{} Winter 2023/24 \par};
\end{tikzpicture}
\end{titlepage}
\part{Quantitative Foundations of Artificial Intelligence}
\part{Quantitative Foundations}
\end{document}
답변1
제목 페이지와 부분 제목에 동일한 형식을 적용하려면 두 항목 모두에 동일한 코드를 사용하는 것이 좋습니다.
\documentclass[paper=a4, fontsize=11pt]{scrbook}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{setspace}
% MODIFY APPEARANCE OF PART PAGES
\renewcommand\partformat{%
\partname~\thepart%
}
% You can do the font selection in the TikZ code below,
% and then either don't change the fontsize here (or
% use \normalsize) would be enough.
\setkomafont{part}{}
\setkomafont{partnumber}{}
% You also do all the distances in the TikZ code, so
% not adding additional distances by the part heading itself
% would be suggested.
\RedeclareSectionCommand[beforeskip=0pt,innerskip=0pt,afterskip=0pt]{part}
\newcommand{\TikZTitle}[2]{%
\begin{tikzpicture}[remember picture, overlay]
% BACKGROUND
\fill[lightgray] ($(current page.north west) + (8mm, -38mm)$) rectangle ($(current page.south east)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (headline) at ($(current page.south west) + (16mm, 32mm)$) {\fontsize{24pt}{34pt}\let\strut\relax\sffamily\bfseries #2\par};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (subheadline) at ($(headline.north west) + (0, 8mm)$) {\fontsize{12pt}{14pt}\sffamily\bfseries #1\par};
% TEXTBOX
\fill[gray, fill opacity=0.9] ($(current page.west |- subheadline.north) + (0mm, 16mm)$) rectangle ($(current page.south west) + (154mm, 16mm)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (headline.south west) {\fontsize{24pt}{34pt}\bfseries\let\strut\relax #2\par};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (subheadline.south west) {\fontsize{12pt}{14pt}\bfseries #1\par};
\end{tikzpicture}
}
\renewcommand\partlineswithprefixformat[3]{%
\thispagestyle{empty}%
\TikZTitle{#2}{#3}%
}
\begin{document}
\sffamily
\onehalfspacing
% TITLE PAGE
\begin{titlepage}
\TikZTitle{Name of University \textbar{} Winter 2023/24}
{Quantitative Foundations of \\ Artificial Intelligence }
\end{titlepage}
\part[{Quantitative Foundations of Artificial Intelligence}]{Quantitative Foundations of \\ Artificial Intelligence}
\part{Quantitative Foundations}
\end{document}
홀수 페이지에 대한 결과는 다음과 같습니다.
\let\strut\relax
KOMA-Script는 항상 \strut
"ace" 및 "ACÉ(generic)"와 같은 높이와 깊이를 갖도록 부품 제목의 텍스트 끝에 를 추가하기 때문에 이 솔루션에 추가했습니다 . 당신은 이것을 원하지 않는 것 같습니다. 그러나 원하는 경우 제목 페이지에서 인수를 제거 \let\strut\relax
하고 인수의 끝 부분을 추가할 수도 있습니다.\strut
\documentclass[paper=a4, fontsize=11pt]{scrbook}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{setspace}
% MODIFY APPEARANCE OF PART PAGES
\renewcommand\partformat{%
\partname~\thepart%
}
% You can do the font selection in the TikZ code below,
% and then either don't change the fontsize here (or
% use \normalsize) would be enough.
\setkomafont{part}{}
\setkomafont{partnumber}{}
% You also do all the distances in the TikZ code, so
% not adding additional distances by the part heading itself
% would be suggested.
\RedeclareSectionCommand[beforeskip=0pt,innerskip=0pt,afterskip=0pt]{part}
\newcommand{\TikZTitle}[2]{%
\begin{tikzpicture}[remember picture, overlay]
% BACKGROUND
\fill[lightgray] ($(current page.north west) + (8mm, -38mm)$) rectangle ($(current page.south east)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (headline) at ($(current page.south west) + (16mm, 32mm)$) {\fontsize{24pt}{34pt}\sffamily\bfseries #2\par};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (subheadline) at ($(headline.north west) + (0, 8mm)$) {\fontsize{12pt}{14pt}\sffamily\bfseries #1\par};
% TEXTBOX
\fill[gray, fill opacity=0.9] ($(current page.west |- subheadline.north) + (0mm, 16mm)$) rectangle ($(current page.south west) + (154mm, 16mm)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (headline.south west) {\fontsize{24pt}{34pt}\bfseries #2\par};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (subheadline.south west) {\fontsize{12pt}{14pt}\bfseries #1\par};
\end{tikzpicture}
}
\renewcommand\partlineswithprefixformat[3]{%
\thispagestyle{empty}%
\TikZTitle{#2}{#3}%
}
\begin{document}
\sffamily
\onehalfspacing
% TITLE PAGE
\begin{titlepage}
\TikZTitle{Name of University \textbar{} Winter 2023/24}
{Quantitative Foundations of \\ Artificial Intelligence\strut}
\end{titlepage}
\part[{Quantitative Foundations of Artificial Intelligence}]
{Quantitative Foundations of \\ Artificial Intelligence}
\part{Quantitative Foundations}
\end{document}
두 경우 모두 제목 페이지와 부분 페이지 간의 유일한 차이점은 제목 페이지의 부제 에 y
, |
및 가 있기 때문에 자막의 높이와 깊이입니다 . /
이러한 차이를 방지하려면 \strut
자막 사용법을 추가하면 됩니다.
\documentclass[paper=a4, fontsize=11pt]{scrbook}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{setspace}
% MODIFY APPEARANCE OF PART PAGES
\renewcommand\partformat{%
\partname~\thepart%
}
% You can do the font selection in the TikZ code below,
% and then either don't change the fontsize here (or
% use \normalsize) would be enough.
\setkomafont{part}{}
\setkomafont{partnumber}{}
% You also do all the distances in the TikZ code, so
% not adding additional distances by the part heading itself
% would be suggested.
\RedeclareSectionCommand[beforeskip=0pt,innerskip=0pt,afterskip=0pt]{part}
\newcommand{\TikZTitle}[2]{%
\begin{tikzpicture}[remember picture, overlay]
% BACKGROUND
\fill[lightgray] ($(current page.north west) + (8mm, -38mm)$) rectangle ($(current page.south east)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (headline) at ($(current page.south west) + (16mm, 32mm)$) {\fontsize{24pt}{34pt}\sffamily\bfseries #2\par};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (subheadline) at ($(headline.north west) + (0, 8mm)$) {\fontsize{12pt}{14pt}\sffamily\bfseries\strut #1\par};
% TEXTBOX
\fill[gray, fill opacity=0.9] ($(current page.west |- subheadline.north) + (0mm, 16mm)$) rectangle ($(current page.south west) + (154mm, 16mm)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (headline.south west) {\fontsize{24pt}{34pt}\bfseries #2\par};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (subheadline.south west) {\fontsize{12pt}{14pt}\bfseries\strut #1\par};
\end{tikzpicture}
}
\renewcommand\partlineswithprefixformat[3]{%
\thispagestyle{empty}%
\TikZTitle{#2}{#3}%
}
\begin{document}
\sffamily
\onehalfspacing
% TITLE PAGE
\begin{titlepage}
\TikZTitle{Name of University \textbar{} Winter 2023/24}
{Quantitative Foundations of \\ Artificial Intelligence\strut}
\end{titlepage}
\part[{Quantitative Foundations of Artificial Intelligence}]
{Quantitative Foundations of \\ Artificial Intelligence}
\part{Quantitative Foundations}
\end{document}
참고: 이론적으로 KOMA-Script는 완전히 새로운 섹션 스타일 정의도 지원합니다. 불행하게도 현재 이 기능에 대한 공식 문서는 없습니다. 현재 내부 명령을 정의해야 하기 때문일 수 있습니다.
\documentclass[paper=a4, fontsize=11pt]{scrbook}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{setspace}
% MODIFY APPEARANCE OF PART PAGES
\renewcommand\partformat{%
\partname~\thepart%
}
\newcommand{\TikZTitle}[2]{%
\begin{tikzpicture}[remember picture, overlay]
% BACKGROUND
\fill[lightgray] ($(current page.north west) + (8mm, -38mm)$) rectangle ($(current page.south east)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white] (headline) at ($(current page.south west) + (16mm, 32mm)$) {\fontsize{24pt}{34pt}\sffamily\bfseries #2\par};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm,
text=white] (subheadline) at ($(headline.north west) + (0, 8mm)$)
{\fontsize{12pt}{14pt}\sffamily\bfseries #1\par};
% TEXTBOX
\fill[gray, fill opacity=0.9] ($(current page.west |- subheadline.north) + (0mm, 16mm)$) rectangle ($(current page.south west) + (154mm, 16mm)$);
% HEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (headline.south west) {\fontsize{24pt}{34pt}\bfseries #2\par};
% SUBHEADLINE
\node[rectangle, anchor=south west, inner sep=0pt, text width=130mm, text=white, draw] at (subheadline.south west) {\fontsize{12pt}{14pt}\bfseries #1\par};
\end{tikzpicture}
}
\makeatletter
% This is used to set the style tikzpart of a command. The argument is the
% name of the command as used for \DeclareSectionCommand etc.
\newcommand*{\scr@dsc@def@style@tikzpart@command}[1]{%
\@namedef{#1}{\dotikzpart{#1}}%
}
% This makes a new heading of type tikzpart. The aruments are:
% #1: The name of the command (see \scr@dsc@def@style@tikzpart@command)
% #2: star or not (star is used for not numbered headings)
% #3: ToC entry (currently only used for numbered headings)
% #4: title
\NewDocumentCommand\dotikzpart{m s O{#4} m}
{
\cleardoubleoddpage\thispagestyle{empty}%
\IfBooleanTF{#2}{%
\TikZTitle{}{#4}%
}{%
\refstepcounter{#1}%
\@nameuse{add#1tocentry}{\@nameuse{the#1}}{#3}%
\TikZTitle{\csname #1format\endcsname}{#4}%
}%
\clearpage
}
\makeatother
\RedeclareSectionCommand[style=tikzpart]{part}% use the new style for \part
\begin{document}
\sffamily
\onehalfspacing
\tableofcontents
% TITLE PAGE
\begin{titlepage}
\TikZTitle{Name of University \textbar{} Winter 2023/24}
{Quantitative Foundations of \\ Artificial Intelligence}
\end{titlepage}
\part[{Quantitative Foundations of Artificial Intelligence}]
{Quantitative Foundations of \\ Artificial Intelligence}
\part{Quantitative Foundations}
\end{document}
참고: 이는 매우 기초적인 예입니다. 예를 들어 원본 KOMA-Script의 확장된 선택적 인수를 지원하지 않습니다 \part
. 그러나 새로운 단면 스타일을 정의하는 것이 매우 쉬울 수 있음을 보여줍니다.