拡張された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

これは可能ですか?

これは単なる minitoc ではないことに注意してください。各セクションには toc に要約が含まれます。

編集: 説明は実際にはパッケージitemize*によって提供される環境ですenumitem

答え1

やり方はこうだエトックセクション要約の目次に加えて、章ごとに 1 つずつ、章要約の「ミニ目次」を追加しました。

この更新では、コメントに応えて 2 番目のコード サンプルが追加されました。番号なしの章 ( ) で メソッドを使用する方法と、各 (現在は番号なし) 章の始めに実行されるセクションの章の収集ではなく\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}

述べる: これは私の答え各セクションの短い要約を組み込んだ2番目の「目次」を作成します。新しいのはパッケージの使用です環境コマンド構文ではなく環境を許可します。 それ以外は、これは本質的に同じテクニックです。


アップデート:

メイン目次のページ(セクション番号用にクラスのデフォルトの予約スペースを使用していることに注意してください。ここでは章に番号が付いていないため大きすぎます。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とそのバリエーションを生成するパッケージマーティン・シャラーの答え項目の追加説明を含む目次部分的な目次に追加のセクションの説明を含めるには:

\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 の画像:

ここに画像の説明を入力してください

部分的な目次の画像をいくつか示します。

ここに画像の説明を入力してください

そして

ここに画像の説明を入力してください

述べる

説明にはsectioninfo環境が提供されます。この環境内では脆弱なコメントを保護する必要があります。説明ではitemize*(from ) が使用されているため、およびには の先頭に を付加する必要があります。enumitem\begin{itemize*}\end{itemize*}\item\protect

関連情報