나는 titlesec과 titletoc을 사용하여 장 제목 뒤에 minitoc을 포함하는 나만의 장 스타일을 만듭니다. 그리고 장 제목 앞에 에피그래프를 추가하고 싶을 때 에피그래프를 사용합니다.
나는 현재 여러 섹션을 포함하는 장을 작성 중이므로 minitoc은 다음 페이지에서 계속되어야 합니다. 이로 인해 비문이 잘못 인쇄되고 다음 예에서는 마지막 부분이 인쇄되지 않습니다.
\documentclass[11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{titletoc}
\usepackage{titlesec}
\newlength{\HeightBeforeChap}
\setlength{\HeightBeforeChap}{0pt}
% redefine chapter style
\titleformat{\chapter}[hang]{\filright}{}{0pt}
{\vspace*{\HeightBeforeChap} \\! \Huge \bfseries\raggedleft}
[\vspace*{4pc}%
\startcontents
{\raggedright\bfseries \large Mini ToC \endgraf}
\titlerule
\vspace{6pt}
\printcontents{p}{1}{\setcounter{tocdepth}{3}}
\vspace{6pt}
\titlerule
]
\usepackage{epigraph}
\renewcommand{\textflush}{flushepinormal}
\setlength\epigraphwidth{.55\textwidth}
\makeatletter
\@ifundefined{HeightBeforeChap}
{% \HeightBeforeChap not defined
}
{% \HeightBeforeChap defined
\renewcommand{\dropchapter}[1]{\setlength{\HeightBeforeChap}{#1} }
}%
\makeatother
\begin{document}
\dropchapter{11pt}
\chapter{title 1}
\epigraphhead[40]{
\epigraph{\itshape Computer programming is an art, because it applies
accumulated knowledge to the world, because it requires skill and ingenuity,
and especially because it produces objects of beauty.
}{Donald Knuth, \textit{"Computer Programming as an Art". Communications of the ACM, Volume 17, Issue 12, dl.acm.org., December 1974}}
}
\dropchapter{0cm}
\section{section 1}
\subsection{title}
\subsubsection{title}
\section{section 2}
\section{section 3}
\section{section 4}
\subsection{title}
\subsubsection{title}
\section{section 5}
\section{section 6}
\section{section 7}
\subsection{title}
\subsubsection{title}
\section{section 8}
\subsection{title}
\subsubsection{title}
\section{section 9}
\subsection{title}
\subsubsection{title}
\section{section 10}
\section{section 11}
\section{section 12}
\section{section 13}
\subsection{title}
\subsubsection{title}
\section{section 14}
\subsection{title}
\subsubsection{title}
\section{section 15}
\subsection{title}
\subsubsection{title}
\section{section 16}
\section{section 17}
\section{section 18}
\section{section 19}
\subsection{title}
\subsubsection{title}
\section{section 20}
\subsection{title}
\subsubsection{title}
\section{section 21}
\subsection{title}
\subsubsection{title}
\section{section}
\chapter{title 2}
\section{title}
\end{document}
님의 답변 덕분에egreg, 제 생각에는 비문을 인쇄하는 데 필요한 페이지가 종료되는 것과 관련이 있는 것 같은데 어떻게 해결해야 할지 모르겠습니다.
도움을 주셔서 감사합니다.
답변1
내가 현상금을 넣은 후에도 댓글이 하나도 없기 때문에 추악한 해결책을 제시하고 SE의 더 나은 해결책을 기다리고 있습니다.
못생긴 것 :
\documentclass[11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{titletoc}
\usepackage{titlesec}
\newlength{\HeightBeforeChap}
\setlength{\HeightBeforeChap}{0pt}
\newcommand{\BeforeChapCmd}{}
\newcommand{\BeforeChap}[1]{\gdef\BeforeChapCmd{#1}}
% redefine chapter style
\titleformat{\chapter}[hang]{\filright}{}{0pt}
{\BeforeChapCmd\leavevmode\vspace*{\HeightBeforeChap}\BeforeChap{}\\ \Huge \bfseries\raggedleft}
[\vspace*{4pc}%
\startcontents
{\raggedright\bfseries \large Mini ToC \endgraf}
\titlerule
\vspace{6pt}
\printcontents{p}{1}{\setcounter{tocdepth}{3}}
\vspace{6pt}
\titlerule
\leavevmode
]
\usepackage{epigraph}
\renewcommand{\epigraphhead}[2][]{\BeforeChap{#2}
\begin{document}
% \dropchapter{11pt}
\epigraphhead[40]{
\epigraph{\itshape Computer programming is an art, because it applies
accumulated knowledge to the world, because it requires skill and ingenuity,
and especially because it produces objects of beauty.
}{Donald Knuth, \textit{"Computer Programming as an Art". Communications of the ACM, Volume 17, Issue 12, dl.acm.org., December 1974}}
}
\chapter{title 1}
% \dropchapter{0cm}
\section{section 1}
\subsection{title}
\subsubsection{title}
\section{section 2}
\section{section 3}
\section{section 4}
\subsection{title}
\subsubsection{title}
\section{section 5}
\section{section 6}
\section{section 7}
\subsection{title}
\subsubsection{title}
\section{section 8}
\subsection{title}
\subsubsection{title}
\section{section 9}
\subsection{title}
\subsubsection{title}
\section{section 10}
\section{section 11}
\section{section 12}
\section{section 13}
\subsection{title}
\subsubsection{title}
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla.
\section{section 14}
\subsection{title}
\subsubsection{title}
\section{section 15}
\subsection{title}
\subsubsection{title}
\section{section 16}
\section{section 17}
\section{section 18}
\section{section 19}
\subsection{title}
\subsubsection{title}
\section{section 20}
\subsection{title}
\subsubsection{title}
\section{section 21}
\subsection{title}
\subsubsection{title}
\section{section}
\chapter{title 2}
\section{title}
\end{document}