확장된 toc과 유사한 환경

확장된 toc과 유사한 환경

나는 책을 조판하고 있어요. 각 장의 시작 부분에는 특별한 목차와 같은 텍스트가 있습니다.

내가 원하는 것은 각 섹션 후에 환경(예를 들어 추상)을 사용하고 각 장의 시작 부분에서 결과를 얻는 것입니다.

\documentclass{book}

\usepackage[inline]{enumitem}

\begin{document}
\chapter{First Chapter}
    \begin{abstract}
        \begin{itemize*}
            \item First this abstract talks about....
            \item Second we have ...
        \end{itemize*}
    \end{abstract}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{First Section}
    \begin{abstract}
        \begin{itemize*}
            \item this section talks about ....
            \item it also tals about
        \end{\itemize*}
    \end{abstract}

bla bla bla
\end{document}

결과:

First Chapter
-- First this abstract talks about.... -- Second we have ...
1. First Section: -- this section talks about .... -- it also talks about

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

*First Section*
bla bla bla

이것이 가능한가?

각 섹션에는 toc에 요약이 있으므로 이것은 단순한 minitoc이 아니라는 점에 유의하세요.

편집: 설명은 실제로 패키지 itemize*에서 제공하는 환경 입니다 enumitem.

답변1

이를 수행하는 방법은 다음과 같습니다.에톡. 나는 장 초록의 "미니톡(minitoc)"을 섹션 초록의 목차에 추가로 장당 하나씩 추가했습니다.

업데이트는 의견에 대한 응답으로 두 번째 코드 샘플을 추가합니다. 즉, 번호가 없는 장( )에 메서드를 사용하는 방법 과 각 장(현재는 번호가 없는)의 시작 부분에서 수행되는 섹션 장을 수집하는 대신 \chapter*사용하는 방법입니다 .enumerate*enumerate

페이지 1

초록 1

3페이지

초록 2

5페이지

초록 3

\documentclass{book}

\usepackage[inline]{enumitem}
\usepackage{etoc}
\usepackage{hyperref}% checking compatibility (also for pdf bookmarks)

\etocsetlevel{chapterabstract}{6}% invisible in TOCs unless level changed
\etocsetlevel{sectionabstract}{6}% invisible in TOCs unless level changed

\usepackage{environ}

%%%%

\NewEnviron {sectionabstract}{%
   \expandafter\SaveSectionAbstract\expandafter {\BODY}%
}%

\newcommand\SaveSectionAbstract [1]{%
   \etoctoccontentsline{sectionabstract}{\unexpanded{\unexpanded{#1}}}}

\NewEnviron {chapterabstract}{%
   \expandafter\SaveChapterAbstract\expandafter {\BODY}%
}%

\newcommand\SaveChapterAbstract [1]{%
   \etoctoccontentsline{chapterabstract}{\unexpanded{\unexpanded{#1}}}}

%%%%

\newcommand\PrintSectionAbstracts {%
    \begingroup
% level must be set *before* use of \etocsetstyle
       \etocsetlevel {sectionabstract}{2}
       \etocsetnexttocdepth {sectionabstract}
       \etocsetlevel {subsection}{3}   
       \etocsetstyle {section}
          {\begin{enumerate}}
          {}
          {\item \etocname:~}
          {\end{enumerate}}
       \etocsetstyle {sectionabstract}
          {}
          {}
          {\etocthename\par}
          {}
       \etocsettocstyle{\subsection*{Section abstracts}}{}
       \localtableofcontents
    \endgroup
}   

\newcommand\PrintChapterAbstracts {%
    \begingroup
       \etocsetlevel {chapterabstract}{1}
       \etocsetnexttocdepth {chapterabstract}
       \etocsetlevel {section}{2}   
       \etocsetstyle {chapter}
          {\begin{enumerate}}
          {}
          {\item \etocname:~}
          {\end{enumerate}}
       \etocsetstyle {chapterabstract}
          {}
          {}
          {\etocthename\par}
          {}
       \etocsettocstyle{\subsection*{Chapter abstracts}}{}
       %\localtableofcontents 
       % better not local, as the main TOC itself, a priori printed before,
       % could have been configured to create a chapter entry in the toc file
       \tableofcontents
    \endgroup
}   

\begin{document}

\tableofcontents % standard table of contents

\PrintChapterAbstracts % chapter abstracts

\chapter{First Chapter}
   \begin{chapterabstract}
        \begin{itemize*}
            \item First this chapter talks about....
            \item Second we have ...
        \end{itemize*}
   \end{chapterabstract}

\PrintSectionAbstracts % section abstracts

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{First Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this first section talks about Lorem ipsum dolor sit amet,
              consetetur sadipscing elitr \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Second Section}

    \begin{sectionabstract}
        \begin{itemize*}
        \item this second section talks about ipsum dolor sit amet, consetetur
          sadipscing elitr,
        \item it also talks about sed diam voluptua. At vero eos et accusam et
          justo duo dolores et ea rebum.
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Third  Section}

    \begin{sectionabstract}
        \begin{itemize*}
        \item this third section talks about ipsum dolor sit amet, consetetur
          sadipscing elitr,
        \item it also talks about sed diam voluptua.
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\chapter{Second Chapter}
   \begin{chapterabstract}
        \begin{itemize*}
        \item First this second chapter talks about ipsum dolor sit amet,
          consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
          labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos
          et accusam et justo duo dolores et ea rebum.
        \item Second we have clita kasd gubergren, no sea takimata sanctus est
          Lorem ipsum dolor sit amet.
        \end{itemize*}
   \end{chapterabstract}

\PrintSectionAbstracts % section abstracts

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{First Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this first section of the second chapter talks about \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Second Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this section talks about \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Third  Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this third section talks about ipsum dolor sit amet, consetetur sadipscing elitr,
            \item it also talks about sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum.
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\end{document}

주목: 이것은 내 내용을 좀 더 자세히 설명한 것입니다.답변에게각 섹션에 대한 간단한 요약을 포함하는 두 번째 "목차"를 만듭니다.. 새로운 점은 패키지를 사용한다는 것입니다.환경명령 구문이 아닌 환경을 허용합니다. 그 외에 이것은 본질적으로 동일한 기술입니다.


업데이트:

주요 목차 페이지(섹션 번호에 대해 클래스 기본 예약 공간을 사용하고 있다는 점에 유의하세요. 장 번호가 지정되지 않은 상태로 남아 있기 때문에 여기서는 너무 큽니다. etoc더 완벽하게 사용할 수 있으며, 예제는 매뉴얼을 참조하거나 다음 용도로 사용할 수 있습니다.) tocloft인쇄된 이 주요 목차를 사용자 정의하는 예호환 모드).

장 초록은 description환경을 사용하여 인쇄됩니다.

섹션 초록 II 1

첫 번째 장의 페이지

섹션 초록 II 2

두 번째 장의 페이지

섹션 초록 II 3

\documentclass{book}

\usepackage[inline]{enumitem}
\usepackage{etoc}
\usepackage{hyperref}% checking compatibility (also for pdf bookmarks)

\etocsetlevel{chapterabstract}{6}% invisible in TOCs unless level changed
\etocsetlevel{sectionabstract}{6}% invisible in TOCs unless level changed

\usepackage{environ}

%%%%

\NewEnviron {sectionabstract}{%
   \expandafter\SaveSectionAbstract\expandafter {\BODY}%
}%

\newcommand\SaveSectionAbstract [1]{%
   \etoctoccontentsline{sectionabstract}{\unexpanded{\unexpanded{#1}}}}

\NewEnviron {chapterabstract}{%
   \expandafter\SaveChapterAbstract\expandafter {\BODY}%
}%

\newcommand\SaveChapterAbstract [1]{%
   \etoctoccontentsline{chapterabstract}{\unexpanded{\unexpanded{#1}}}}

%%%%

\newcommand\PrintSectionAbstracts {%
    \begingroup
% level must be set *before* use of \etocsetstyle
       \etocsetlevel {sectionabstract}{2}
       \etocsetnexttocdepth {sectionabstract}
       \etocsetlevel {subsection}{3}  
% enumitem redefinition of \item causes the closing of groups
% hence either some \expandafter, or like here \global saving
% of number and name 
       \etocsetstyle {section}
          {\begin{enumerate*}}
          {\global\let\EtocNumber\etocthenumber
           \global\let\EtocName\etocthelinkedname}
          {\item [{\bfseries\EtocNumber.}~]\EtocName: }
          {\end{enumerate*}}
       \etocsetstyle {sectionabstract}
          {}
          {}
          {\etocthename\par}
          {}
       \etocsettocstyle{\subsection*{Section abstracts}}{\medskip}
       \localtableofcontents
    \endgroup
}   

\newcommand\PrintChapterAbstracts {%
    \begingroup
       \etocsetlevel {chapterabstract}{1}
       \etocsetnexttocdepth {chapterabstract}
       \etocsetlevel {section}{2}   
       \etocsetstyle {chapter}
          {\begin{description}}
          {}
          {\item[\etocname] }
          {\end{description}}
       \etocsetstyle {chapterabstract}
          {}
          {}
          {\etocthename\par}
          {}
       \etocsettocstyle{\subsection*{Chapter abstracts}}{}
       \tableofcontents
    \endgroup
}   

\begin{document}

\renewcommand{\thesection}{\arabic{section}}

\tableofcontents % standard table of contents

\PrintChapterAbstracts % chapter abstracts

\chapter*{First Chapter}
\addcontentsline{toc}{chapter}{First Chapter}

   \begin{chapterabstract}
        \begin{itemize*}
            \item First this chapter talks about....
            \item Second we have ...
        \end{itemize*}
   \end{chapterabstract}

\PrintSectionAbstracts % section abstracts

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{First Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this first section talks about Lorem ipsum dolor sit amet,
              consetetur sadipscing elitr \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\subsection{this subsection should not create problems}

\section{Second Section}

    \begin{sectionabstract}
        \begin{itemize*}
        \item this second section talks about ipsum dolor sit amet, consetetur
          sadipscing elitr,
        \item it also talks about sed diam voluptua. At vero eos et accusam et
          justo duo dolores et ea rebum.
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Third  Section}

    \begin{sectionabstract}
        \begin{itemize*}
        \item this third section talks about ipsum dolor sit amet, consetetur
          sadipscing elitr,
        \item it also talks about sed diam voluptua.
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\chapter*{Second Chapter}
\addcontentsline{toc}{chapter}{Second Chapter}

   \begin{chapterabstract}
        \begin{itemize*}
        \item First this second chapter talks about ipsum dolor sit amet,
          consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
          labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos
          et accusam et justo duo dolores et ea rebum.
        \item Second we have clita kasd gubergren, no sea takimata sanctus est
          Lorem ipsum dolor sit amet.
        \end{itemize*}
   \end{chapterabstract}

\PrintSectionAbstracts % section abstracts

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{First Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this first section of the second chapter talks about \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Second Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this section talks about \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Third  Section}

    \begin{sectionabstract}
    \begin{itemize*}
    \item this third section talks about ipsum dolor sit amet, consetetur
      sadipscing elitr,
    \item it also talks about sed diam voluptua.
    \end{itemize*}
    \end{sectionabstract}

bla bla bla

\end{document}

답변2

다음은titletoc부분 ToC와 변형을 생성하는 패키지마틴 샤러의 답변에게항목에 대한 추가 설명이 포함된 목차부분 ToC에 추가 섹션 설명을 포함하려면 다음을 수행하세요.

\documentclass{book}
\usepackage{titletoc}
\usepackage{environ}
\usepackage[inline]{enumitem}
\usepackage{lipsum}

\makeatletter
\def\@nodottedtocline#1#2#3#4#5{%
  \ifnum #1>\c@tocdepth \else
    \vskip \z@ \@plus.2\p@
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
     \parindent #2\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima #3\relax
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {#4}\nobreak
     \leaders\hbox{$\m@th
        \mkern \@dotsep mu\hbox{\,}\mkern \@dotsep
        mu$}\hfill
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor }%
     \par}%
  \fi}
\newcommand*\l@sectioninfo{\@nodottedtocline{1}{1.5em}{2.3em}}
\NewEnviron{sectioninfo}{%
    \addcontentsline{ptc}{sectioninfo}{%
    \noexpand\numberline{}\BODY}%
}
\makeatother

\def\PrintContents{%
\startcontents%
\printcontents{}{1}{{\bfseries\Large\contentsname}%
  \par\nobreak\vskip-6pt\noindent\hrulefill}%
  \vskip-6pt\noindent\hrulefill\vskip3\baselineskip%
}

\begin{document}
\tableofcontents

\chapter{First chapter}
\PrintContents

\lipsum[4]

\section{First section of chapter one}
\begin{sectioninfo}
\protect\begin{itemize*}
\protect\item The first important thing about this section.
\protect\item The second important thing about this section.
\protect\item The third important thing about this section.
\protect\end{itemize*}%
\end{sectioninfo}
\lipsum[4]
\section{Second section of chapter one}
\begin{sectioninfo}
\protect\begin{itemize*}
\protect\item The first important thing about this section.
\protect\item The second important thing about this section.
\protect\item The third important thing about this section.
\protect\item The fourth important thing about this section.
\protect\end{itemize*}%
\end{sectioninfo}
\lipsum[4]

\chapter{Second chapter}
\PrintContents

\lipsum[4]

\section{First section of chapter two}
\begin{sectioninfo}
\protect\begin{itemize*}
\protect\item The first important thing about this section.
\protect\item The second important thing about this section.
\protect\end{itemize*}%
\end{sectioninfo}
\lipsum[4]
\section{Second section of chapter two}
\begin{sectioninfo}
\protect\begin{itemize*}
\protect\item The first important thing about this section.
\protect\item The second important thing about this section.
\protect\item The third important thing about this section.
\protect\end{itemize*}%
\end{sectioninfo}
\lipsum[4]

\end{document}

일반 ToC 이미지:

여기에 이미지 설명을 입력하세요

부분 ToC의 일부 이미지는 다음과 같습니다.

여기에 이미지 설명을 입력하세요

그리고

여기에 이미지 설명을 입력하세요

주목

설명은 sectioninfo환경과 함께 제공됩니다. 이 환경에서는 취약한 댓글을 보호해야 합니다. itemize*(from ) 이 enumitem설명에 사용되었으므로 앞에 가 필요 합니다 .\begin{itemize*}\end{itemize*}\item\protect

관련 정보