2

I have a ToC and list of problems in the same document. I struggle to make them look the same. I solved all, but the following issue.

In ToC (and LoF) there's a space between chapters. listtheorems doesn't have it. I guess there should be a way to patch it to get verical space between chapters.

\documentclass{book}

% =====================
%% XeTeX customization:

\usepackage{fontspec} % enagles loading of OpenType fonts
\usepackage{polyglossia} % support for languages

% fonts:
\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text} % without this XeLaTeX won't turn "--" into dashes
\setmainfont{Arial}
\setsansfont{Arial}
\setromanfont{Arial}
\setmonofont{DejaVu Sans Mono}

% Russian/English document:
\usepackage{xecyr}
\newfontfamily\cyrillicfont{Arial}

\setmainlanguage{russian}
\setdefaultlanguage{russian}
\setotherlanguage{english}


% =======================
%% hyperref and ntheorem:

\usepackage[hyperref]{ntheorem}
\theoremlisttype{all}

\makeatletter
\newtheoremstyle{problem}
  {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}%
  {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}
\makeatother
\theoremstyle{problem}
\newtheorem{problem}{Задача}[chapter]

\usepackage{hyperref}


\begin{document}


\tableofcontents

\chapter*{List of problems}
\listtheorems{problem}

\chapter{foo}

\begin{problem}[Short foo name]
  Foo!
\end{problem}

\chapter{bar}

\begin{problem}[Short bar name]
  Bar!
\end{problem}

\chapter{baz}

\begin{problem}[Short baz name]
  Baz!
\end{problem}

\end{document}
2
  • 1
    This looks like a near duplicate of tex.stackexchange.com/q/10159/15925: just replace addtocontents by addtotheoremfile in that code. Feb 27, 2013 at 15:31
  • @AndrewSwann: please make it an answer -- so I could accept it. The two lines that solve it: \let\Chapter\chapter \def\chapter{\addtotheoremfile{\protect\addvspace{10pt}}\Chapter}.
    – Adobe
    Feb 27, 2013 at 15:58

1 Answer 1

4

This looks like a near duplicate of this question about the list of listings: just replace \addtocontents by \addtotheoremfile in that code giving:

\let\Chapter\chapter 
\def\chapter{\addtotheoremfile{\protect\addvspace{10pt}}\Chapter}

which writes an extra vertical space to the list of the theorems at the beginning of each chapter.

Theorem list sample

Contents sample

\documentclass{book}

\usepackage[hyperref]{ntheorem}
\theoremlisttype{all}

\makeatletter
\newtheoremstyle{problem}
  {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}%
  {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}
\makeatother
\theoremstyle{problem}

\newtheorem{problem}{Problem}[chapter]

\usepackage{hyperref}

\let\Chapter\chapter
\def\chapter{\addtotheoremfile{\protect\addvspace{10pt}}\Chapter}

\begin{document}

\tableofcontents

\chapter*{List of problems}
\listtheorems{problem}

\chapter{foo}

\begin{problem}[Short foo name]
  Foo!
\end{problem}

\begin{problem}[Fee fi fo fum]
  Fee fi fo fum.
\end{problem}

\chapter{bar}

\begin{problem}[Short bar name]
  Bar!
\end{problem}
\begin{problem}[Name beanstalk]
  Beanstalk.
\end{problem}

\chapter{baz}

\begin{problem}[Short baz name]
  Baz!
\end{problem}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .