Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
1  
This looks like a near duplicate of tex.stackexchange.com/q/10159/15925: just replace addtocontents by addtotheoremfile in that code. –  Andrew Swann Feb 27 '13 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 '13 at 15:58
add comment

1 Answer

up vote 2 down vote accepted

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.