Não consigo determinar o erro entre hyperref e hypdvips

Não consigo determinar o erro entre hyperref e hypdvips

Veja o seguinte exemplo mínimo não funcional. Não está correto, pois o pdf de saída será criado. No entanto, o arquivo de log produz um erro. Levei muito tempo e ainda não tenho certeza se a culpa é minha ou não.

Baixei uma nova versão portátil da distribuição MiKTeX 2.9.5105 e atualizei o pacote. Eu compilo com arquivo em lote dvi-ps-pdf

Aqui está o MWE

\documentclass{scrreprt}
\usepackage[utf8]{inputenc} % Uses the utf8 input encoding
\usepackage{hyperref}
\usepackage{hypdvips}

\begin{document}
\chapter*{Impressum}
\chapter{Zu diesem Dokument}
Dieses Installationsanleitung erläutert alle Themen um den -Client installieren zu     können und ist als Leitfaden mit Zusatzinformationen aufgebaut. Bestimmte abgebildete windowsspezifische Programmelemente können in den Windowsversionen abweichen, gelten aber sinngemäß. 
\section{Symbole und Auszeichnungen}

\section{Want to use command from package hypdvips}
\attachfile[description={MNWEB.log},flags=0000000001, mimetype=application/txt]{MNWEB.log}
\end{document}  

O arquivo de erro mostra o seguinte erro.

LaTeX Info: Redefining \ref on input line 25.
LaTeX Info: Redefining \pageref on input line 25.
LaTeX Info: Redefining \nameref on input line 25.
 [2


]
Chapter 1.
! Missing \endcsname inserted.
<to be read again> 
               \@ne 
l.29  \section
          {Symbole und Auszeichnungen}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Missing \endcsname inserted.
<to be read again> 
               \@ne 
l.29  \section
          {Symbole und Auszeichnungen}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Missing \endcsname inserted.
<to be read again> 
               \BKM@style@\@ne  
l.29  \section
              {Symbole und Auszeichnungen}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Extra \endcsname.
\KVS@ProcessorDefault ...sname KV@#1@#2\endcsname 
                                              \unless \ifcsname KVS@#1@h...
l.29  \section
              {Symbole und Auszeichnungen}
I'm ignoring this, since I wasn't doing a \csname.


! Package kvsetkeys Error: Undefined key `\BKM@style@\@ne  '.

See the kvsetkeys package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.29  \section
          {Symbole und Auszeichnungen}
The keyval family of the key `\BKM@style@\@ne  ' is `BKM'.
The setting of the key is ignored because of the error.

Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

Package atveryend Info: Executing hook `BeforeClearDocument' on input line 30.
[3

Se ninguém perceber minha falha, então pode ser um bug, reportarei depois de alguns dias.

Cumprimentos

EDITAR2:

Compile com estes comandos.

set B=C:\tex\miktex\bin\
set gs_path=d:\peter\Programme\gs\gs9.10\bin\
%B%latex --enable-write18 --src -interaction=nonstopmode --save-size=80000 MWE.tex
%B%dvips -P pdf -D1200 MWE.dvi"
%gs_path%gswin32c.exe -sPAPERSIZE=a4 -dNOSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFileMWE.pdf -c save pop -f MWE.ps

Peter

Responder1

O erro aparece ao usar scrreprt, pois define

% scrreprt.cls, line 2874:
\newcommand\section{%
  \@startsection{section}{\sectionnumdepth}{\z@}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {2.3ex \@plus.2ex}%
  {\ifnum \scr@compatibility>\@nameuse{scr@[email protected]}\relax
    \setlength{\parfillskip}{\z@ plus 1fil}\fi
    \raggedsection\normalfont\sectfont\nobreak\size@section}%
}

e também

% scrreprt.cls, line 2397:
\newcommand*{\sectionnumdepth}{\@ne}

Quando o marcador da seção está sendo construído, \BKM@currentlevelé definido via

\xdef\BKM@currentlevel{<second argument to \startsection>}

que neste caso dá o mesmo que

\gdef\BKM@currentlevel{\@ne}

porque \@neé inexpansível. Mas então \BKM@currentlevelé usado dentro de casa \csname...\endcsname, onde \@neé ilegal.

Aqui está uma correção (proposta por Heiko Oberdiek): após o carregamento, hypdvipsaltere como \@startsectioné redefinido com

\makeatletter
\def\@startsection#1#2#3#4#5#6{%
  \bookmarksetup{style=pp@bmstyle@empty}%
  \ifx\@M#2%
    \xdef\BKM@currentlevel{1}%
  \else
    \xdef\BKM@currentlevel{\number#2}%
  \fi
  \@ifundefined{BKM@style@\BKM@currentlevel}{}{\bookmarksetup{style=\BKM@currentlevel}}%
  \pp@backup@@startsection{#1}{#2}{#3}{#4}{#5}{#6}%
}
\makeatother

Uma solução alternativa talvez mais simples é corrigir \sectionpara ter \number\sectionnumdepth:

\documentclass{scrreprt}
\usepackage[utf8]{inputenc} % Uses the utf8 input encoding
\usepackage{etoolbox}
\usepackage[pdfencoding=auto]{hyperref} % don't forget the option
\usepackage{hypdvips}

\patchcmd{\section}{\sectionnumdepth}{\number\sectionnumdepth}{}{}

\begin{document}

\chapter*{Impressum}

\chapter{Zu diesem Dokument} 

Dieses Installationsanleitung erläutert alle Themen um den -Client installieren 
zu können und ist als Leitfaden mit Zusatzinformationen aufgebaut. Bestimmte 
abgebildete windowsspezifische Programmelemente können in den Windowsversionen 
abweichen, gelten aber sinngemäß.

\section{Symbole und Auszeichnungen}

\section{Want to use command from package hypdvips}
\attachfile[description={MNWEB.log},flags=0000000001, mimetype=application/txt]{MNWEB.log}
\end{document}  

informação relacionada