7

Look at the following Minimal Non Working Example. It's not correct, because the output pdf will be created. Nevertheless the logfile produces an error. It took me a lot of time and I am still not sure whether its my fault or not.

I have downloaded a brand new MiKTeX 2.9.5105 distribution portable version and updated the package. I compile with dvi-ps-pdf batchfile

Here is the 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}  

The errorfile shows the following error.

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

If no one will see my fault, than it could be a bug, I will report after a view days.

Best regrads

EDIT2:

Compile with this commands.

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

  • I can compile your document with latex+dvipdf on TeXLive 2013 on Linux, and with pdflatex, when I omit the inclusion of hypdvips. I assume, there is some incompatibility between hyperref and hypdvips. Is there any need to include both of them. In my point of view is sufficient to use just hyperref. – user31729 Mar 28 '14 at 4:19
  • Comiled on windows 7, windows8. All the same. Want to use this command. See changed Post. – Peter Ebelsberger Mar 28 '14 at 9:37
  • @ChristianH. i would rather suspect cleveref interacting badly with hypdvips, than a hypdvips<->hyperref clash. – wasteofspace Mar 28 '14 at 9:57
  • The conflict is with scrreprt; if I use report, no error is raised. – egreg Mar 28 '14 at 11:39
  • thank greg, but I have allready reported to the maintainer of the two packages. The idea, that scrreprt can be the reaseon is totaly unexpected to me. :( – Peter Ebelsberger Mar 28 '14 at 11:41
5

The error appears when using scrreprt, because it defines

% 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@v@2.96}\relax
    \setlength{\parfillskip}{\z@ plus 1fil}\fi
    \raggedsection\normalfont\sectfont\nobreak\size@section}%
}

and also

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

When the bookmark for the section is being constructed, \BKM@currentlevel is defined via

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

which in this case gives the same as

\gdef\BKM@currentlevel{\@ne}

because \@ne is unexpandable. But then \BKM@currentlevel is used inside \csname...\endcsname, where \@ne is illegal.

Here's a fix (proposed by Heiko Oberdiek): after loading hypdvips change how \@startsection is redefined with

\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

A perhaps simpler workaround is to patch \section to have \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}  
  • And it should be fixed in hypdvips: \xdef\BKM@currentlevel{\number#2} in its redefinition of \@startsection. (Also \ifx#2\@M% and similar should be replaced by \ifx\@M#2% for the case that #2 starts with equal tokens, e.g. 11 or 22.) – Heiko Oberdiek Mar 28 '14 at 13:00
  • @HeikoOberdiek Sure thing. I'll change the patch in my answer. It was easier patching \section for the particular case. – egreg Mar 28 '14 at 13:49
  • The first patch did not work as expected. Sure, for the MWE it did the work. But it seems to me that I would have to make an other MWE for the next problem. After trying the patch from Heiko, everything works fine. Thank you for your help. – Peter Ebelsberger Mar 28 '14 at 14:49
  • A new version of hypdvips has been uploaded to CTAN; from the README file: v3.01 - supports newer versions of KOMA-Script (thanks to Peter Ebelsberger for the bug-report and to Enrico Gregorio and Heiko Oberdiek for analyzing and fixing the bug). – egreg Apr 3 '14 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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