我在同一个文档中有一个目录和问题列表。我努力让它们看起来一样。我解决了所有问题,但以下问题除外。
在 ToC(和 LoF)中,章节之间有空格。listtheorems
没有。我想应该有办法修补它以获得章节之间的垂直空间。
\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}
答案1
这看起来像是有关清单列表的此问题的近似重复:只需在代码中\addtocontents
替换即可:\addtotheoremfile
\let\Chapter\chapter
\def\chapter{\addtotheoremfile{\protect\addvspace{10pt}}\Chapter}
它在每章开头的定理列表中写入一个额外的垂直空间。
\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}