
セクションコマンドのスタイル設定にパッケージを使用していますtitlesec
。しかし、章の幅や右余白に問題があります。
テキストの幅は青い線までしか届かず、「構成」と「表示」は区切られる必要があります。\\
オプションであることはわかっていますが、フッターには章名も参照されます。
したがって、 を使用すると\\
、フッターのテキストは「Konzepte für die semantische」になります...
スタイリングは:
% > formats: \chapter
\titleformat{\chapter}[display]%
{\usekomafont{chapter}}%
{\vspace{-8em}\raggedleft{%
{\color{ctcolorchapterline}%
\rule[-5pt]{2pt}{5cm}}\quad%
{\color{ctcolorchapternum}
\fontsize{60}{60}\selectfont\thechapter}%
}%
}%
{-2.1em}%
{\raggedright}%
[\phantomsection]
答え1
titlesec のオプションを使用して、希望する長さのexplicit
内にタイトルを配置できます。ここで、セクション単位のタイトルを取得するには、(通常は の最後の必須引数で) を使用する必要があることに注意してください。ボックスの幅として を使用しましたが、この値は必要に応じて変更できます。以下の例では、質問で指定されていなかったため、使用する色の定義をいくつか示しました。\parbox
#1
\titleformat
\textwidth-3em
\documentclass{scrbook}
\usepackage{xcolor}
\usepackage[explicit]{titlesec}
\usepackage{lmodern}% just for the example
\usepackage{lipsum}% just for the example
\usepackage{hyperref}
\colorlet{ctcolorchapterline}{cyan}
\colorlet{ctcolorchapternum}{cyan}
\titleformat{\chapter}[display]%
{\usekomafont{chapter}}%
{\vspace{-8em}\raggedleft{%
{\color{ctcolorchapterline}%
\rule[-5pt]{2pt}{5cm}}\quad%
{\color{ctcolorchapternum}
\fontsize{60}{60}\selectfont\thechapter}%
}%
}%
{-2.1em}%
{\parbox[b]{\dimexpr\textwidth-3em\relax}{\raggedright#1}}%
[\phantomsection]
\begin{document}
\chapter{A test chapter with a long title that will span two lines}
\lipsum[4]
\end{document}
としてエグレ指摘した彼のコメントexplicit
補助マクロを使用すると、オプションの使用を避けることができます。
\documentclass{scrbook}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{lmodern}% just for the example
\usepackage{lipsum}% just for the example
\usepackage{hyperref}
\colorlet{ctcolorchapterline}{cyan}
\colorlet{ctcolorchapternum}{cyan}
\newcommand\mychapformat[1]{%
\parbox[b]{\dimexpr\textwidth-3em\relax}{\raggedright#1}}
\titleformat{\chapter}[display]%
{\usekomafont{chapter}}%
{\vspace{-8em}\raggedleft{%
{\color{ctcolorchapterline}%
\rule[-5pt]{2pt}{5cm}}\quad%
{\color{ctcolorchapternum}
\fontsize{60}{60}\selectfont\thechapter}%
}%
}%
{-2.1em}%
{\mychapformat}%
[\phantomsection]
\begin{document}
\chapter{A test chapter with a long title that will span two lines}
\lipsum[4]
\end{document}
\sectfont
KOMA セクション単位でデフォルトで使用される太字の sansseerf フォントを維持できるように、定義に追加しました。
\documentclass{scrbook}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{lmodern}% just for the example
\usepackage{lipsum}% just for the example
\usepackage{hyperref}
\colorlet{ctcolorchapterline}{cyan}
\colorlet{ctcolorchapternum}{cyan}
\newcommand\mychapformat[1]{%
\parbox[b]{\dimexpr\textwidth-3em\relax}{\raggedright#1}}
\titleformat{\chapter}[display]%
{\usekomafont{chapter}\sectfont}%
{\vspace{-8em}\raggedleft{%
{\color{ctcolorchapterline}%
\rule[-5pt]{2pt}{5cm}}\quad%
{\color{ctcolorchapternum}
\fontsize{60}{60}\selectfont\thechapter}%
}%
}%
{-2.1em}%
{\mychapformat}%
[\phantomsection]
\begin{document}
\chapter{A test chapter with a long title that will span two lines}
\lipsum[4]
\end{document}
とKOMAスクリプトは完全に互換性がない可能性があることに注意してくださいtitlesec
( をロードするときにKOMAクラスから警告が表示されますtitlesec
)。KOMA-Script と titlesec の非互換性