4

I'm trying to make use of this solution to get list of problems.

I'm using XeTeX, and if I use non-english as a problem name -- hyperref's links to problem in "List of problems" doesn't work.

Here's a MWE:

\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{Задача}{Задача}[chapter]

\usepackage{hyperref}


\begin{document}

\chapter*{List of problems}
\listtheorems{Задача}

\chapter{foo}

\begin{Задача}[Short foo name]
  Foo!
\end{Задача}

\chapter{bar}

\begin{Задача}[Short bar name]
  Bar!
\end{Задача}

\end{document}

It needs to be compiled with xelatex. I want to get clickable list of problems.

I tried to add some options to hyperref:

\hypersetup{xetex,
  unicode=true,
  pdfencoding=unicode,
  bookmarks={true},
}

it doesn't work.

Edit:

Versions:

ntheorem 1.31 
hyperref 6.82q
polyglossia 1.2.1
xecyr 1.0

Complete compile log is here.

Edit 2:

Here's thm file on request of egreg:

\contentsline {Задача}{{Задача}{1.{1}}{Short foo name}}{3}{Задача.1.1}
\contentsline {Задача}{{Задача}{2.{1}}{Short bar name}}{5}{Задача.2.1}

With the solution I posted below the same file is

\contentsline {problem}{{Задача}{1.{1}}{Short foo name}}{3}{problem.1.1}
\contentsline {problem}{{Задача}{2.{1}}{Short bar name}}{5}{problem.2.1}
Adobe
  • 3,037

1 Answers1

2

Oh I solved it:

\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}

\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}

\end{document}

The trick is to have problem as an internal problem name:

\newtheorem{problem}{Задача}[chapter]

and generate list of problems with:

\listtheorems{problem}

Sample problem:

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

Still after compilation I get Задача as a problem name.

Despite this solves the problem I'd like to mention that egreg who have a newer xelatex distriburion don't get an issue at all.

Adobe
  • 3,037