Epigraph und Titlesec+Titletoc führen zu Fehlverhalten

Epigraph und Titlesec+Titletoc führen zu Fehlverhalten

Ich verwende „titlesec“ und „titletoc“, um meinen eigenen Kapitelstil zu erstellen, der nach dem Kapiteltitel ein „minitoc“ enthält. Und ich verwende „epigraph“, wenn ich eines vor dem Kapiteltitel haben möchte.

Ich schreibe gerade ein Kapitel, das aus mehreren Abschnitten besteht, sodass die Minitoc auf der nächsten Seite fortgesetzt werden muss. Dies führt zu einem falschen Ausdruck des Epigraphs und im folgenden Beispiel werden die letzten Abschnitte nicht gedruckt:

\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}

Hier sind die Ergebnisse, die ich erhalte:Bildbeschreibung hier eingebenBildbeschreibung hier eingeben

Dank der Antwort vonegreg, ich denke, das hängt mit der Beendigung der Seite zusammen, die zum Drucken des Epigraphs benötigt wird, aber ich habe keine Ahnung, wie ich das lösen kann.

Ich danke Ihnen für Ihre Hilfe.

Antwort1

Da es auch nach der von mir ausgesetzten Kopfprämie keinen einzigen Kommentar gibt, komme ich mit einer hässlichen Lösung und warte auf bessere Lösungen von SE.

Der Hässliche:

\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}

verwandte Informationen