怎么能下列(titleformat
部分)适用于标准图书类别且不适用于classicthesis
:
\documentclass[11pt,a4paper,footinclude=true,headinclude=true]{scrbook} % KOMA-Script book
\usepackage{lipsum}
\usepackage{graphicx} %% For \scalebox
\usepackage{classicthesis} %
\titleformat{\chapter}[display]%
{\relax}
{\mbox{}\oldmarginpar{\vspace*{4\baselineskip}%
\color{halfgray}\scalebox{1.5}{\chapterNumber\thechapter}}}
{0pt}%
{\raggedright\spacedallcaps}[\normalsize\vspace*{.8\baselineskip}\titlerule]%
\titlespacing*{\chapter}{0pt}{0pt}{1.2\baselineskip}
\begin{document}
\tableofcontents
\chapter{The grand design}
\section{First principles}
\subsection{Typography exists to honour content}
\lipsum
\end{document}
例如,为什么下面会Undefined control sequence. [\chapter{The grand design}]
出错:
\documentclass[12pt, a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage{microtype}
\usepackage{libertine}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{adjustbox}
\usepackage{graphicx}
\usepackage{xparse}
\usepackage{xcolor}
\titleformat{\chapter}[display]%
{\relax}
{\mbox{}\oldmarginpar{\vspace*{4\baselineskip}%
\color{gray}\scalebox{1.5}{\chapterNumber\thechapter}}}
{0pt}%
{\raggedright\spacedallcaps}[\normalsize\vspace*{.8\baselineskip}\titlerule]%
\titlespacing*{\chapter}{0pt}{0pt}{1.2\baselineskip}
\begin{document}
\chapter{The grand design}
\section{First principles}
\subsection{Typography exists to honour content}
\lipsum
\end{document}
答案1
至少这是有效的,我没有与原版做过太多的比较。
\documentclass[11pt,a4paper]{book}
\usepackage{lipsum}
\usepackage{graphicx} %% For \scalebox
%\usepackage{classicthesis} %
\usepackage{titlesec} % for \titleformat
\usepackage{microtype} % for \textls, used in \spacedallcaps
\usepackage{textcase} % for \MakeTextUppercase, used in \spacedallcaps
\usepackage{xcolor} % for color
\colorlet{halfgray}{black!45} % color of chapter number
\DeclareFixedFont{\chapterNumber}{T1}{pplj}{m}{n}{70} % font definition
\DeclareRobustCommand{\spacedallcaps}[1]{\textls[160]{\MakeTextUppercase{#1}}} % used in chapter style
\titleformat{\chapter}[display]%
{\relax}
{\mbox{}\marginpar{\vspace*{4\baselineskip}% changed \oldmarginpar to \marginpar
\color{halfgray}\scalebox{1.5}{\chapterNumber\thechapter}}}
{0pt}%
{\raggedright\spacedallcaps}[\normalsize\vspace*{.8\baselineskip}\titlerule]%
\titlespacing*{\chapter}{0pt}{0pt}{1.2\baselineskip}
\begin{document}
\tableofcontents
\chapter{The grand design}
\section{First principles}
\subsection{Typography exists to honour content}
\lipsum
\end{document}
关于你的最后一个例子,完整的错误是
! Undefined control sequence.
<argument> \mbox {}\oldmarginpar
{\vspace *{4\baselineskip }\color {gray}\sc...
l.23 \chapter{The grand design}
?
这意味着\oldmarginpar
未定义(错误中换行符之前的最后一个宏)。classicthesis
执行\let\oldmarginpar\marginpar
,然后重新定义\marginpar
。 因此在 中使用\marginpar
而不是。\oldmarginpar
\titleformat
您也会得到\chapterNumber
和的错误\spacedallcaps
,因为这些是 中定义的宏classicthesis.sty
。我从那里得到了定义。最后halfgray
是 定义的颜色classicthesis
,所以您也需要它的定义。