[Tex/LaTex] Conflict between the modified .sty file and babel’s ngerman

babelerrorspackagespdfsync

There is some conflict or error I don't understand. I can skip it and nothing visible happens. The output is okay and everything seems to be fine. Still I would like to get rid of the error message. If I run the following minimal example:

\documentclass[]{scrbook}

\usepackage[applemac, grafiken]{tahbiblatex}
\usepackage[ngerman]{babel}


\begin{document}

Testing äüöaüä.

\end{document}

I get the error message:

   ! Missing = inserted for \ifnum.
<to be read again> 
                   ,
l.4 \usepackage
               [ngerman]{babel}
? 
! Missing number, treated as zero.
<to be read again> 
                   ,
l.4 \usepackage
               [ngerman]{babel}

Here is my .sty file:

\NeedsTeXFormat{LaTeX2e}\relax
\ProvidesPackage{tahbiblatex}[2012, by tah modified by sm]

\RequirePackage{ifthen}

\DeclareOption{latin1}{\PassOptionsToPackage{\CurrentOption}{inputenc}}
\DeclareOption{applemac}{\PassOptionsToPackage{\CurrentOption}{inputenc}}
\DeclareOption{cp850}{\PassOptionsToPackage{\CurrentOption}{inputenc}}
\DeclareOption{utf8}{\PassOptionsToPackage{\CurrentOption}{inputenc}}

\DeclareOption{dvi}{%
\newif\ifpdf
\ifx\pdfoutput\undefined
    \pdffalse
\else
    \pdfoutput=0
    \pdftrue
\fi}

\newcounter{Grafiken}\setcounter{Grafiken}{0}
\DeclareOption{grafiken}{\setcounter{Grafiken}{1}}

\newcounter{Randausgleich}\setcounter{Randausgleich}{0}
\DeclareOption{randausgleich}{\setcounter{Randausgleich}{1}}

\newcounter{Tabellen}\setcounter{Tabellen}{0}
\DeclareOption{tabellen}{\setcounter{Tabellen}{1}}

\newcounter{Sync}\setcounter{Sync}{0}
\DeclareOption{sync}{\setcounter{Sync}{1}}

\ProcessOptions

\RequirePackage{fixltx2e}
\RequirePackage{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[T1]{url}
\RequirePackage{setspace}
%\RequirePackage[german]{varioref}
\RequirePackage{textcomp}

\newcommand{\urlangabe}[2]{%
$\langle$\url{#1}$\rangle$ -- Zugriff am #2}

\def\hierlockern {\begingroup \def\par{\endgraf\endgroup}%
  \tolerance 1414%
  \hbadness 1414%
  \emergencystretch 1.5em%
  \hfuzz 0.3pt%
  \vfuzz \hfuzz%
  \raggedbottom%
}

\newcommand{\alleslockern}{%
  \tolerance 1414%
  \hbadness 1414%
  \emergencystretch 1.5em%
  \hfuzz 0.3pt%
  \vfuzz \hfuzz%
  \raggedbottom%
}
\ifthenelse{\value{Grafiken}=1}
  {
  \ifx\pdfoutput\undefined \newcount\pdfoutput \fi
  \ifcase\pdfoutput
      \RequirePackage[dvips]{graphicx}
      \DeclareGraphicsExtensions{.eps}
      \typeout{Paket tah Meldung: Die Option `grafiken' fuer DVI wurde gewaehlt.}%
\else
    \RequirePackage[pdftex]{graphicx}
    \DeclareGraphicsExtensions{.jpg,.tif,.png,.pdf}
    \typeout{Paket tah Meldung: Die Option `grafiken' fuer PDF wurde gewaehlt.}%
  \fi}
  {}

\ifthenelse{\value{Sync}=1}
  {
    \ifx\pdfoutput\undefined \newcount\pdfoutput \fi
    \ifcase\pdfoutput
    \RequirePackage{srcltx}
    \typeout{Paket tah Meldung: Die Option `sync' fuer DVI wurde gewaehlt.}%
    \else
    \RequirePackage{pdfsync}
    \typeout{Paket tah Meldung: Die Option `sync' fuer PDF wurde gewaehlt.}%
    \fi
}
  {}


\ifthenelse{\value{Randausgleich}=1}
  {\typeout{Paket tah Meldung: Die Option `randausgleich' wurde gewaehlt.}%
  \RequirePackage[activate]{pdfcprot}}
  {}

\ifthenelse{\value{Tabellen}=1}
  {\typeout{Paket tah Meldung: Die Option `tabellen' wurde gewaehlt.}%
  \RequirePackage{tabularx}
  \RequirePackage{ragged2e}
  \RequirePackage{dcolumn}
  \RequirePackage{booktabs}
  \newcolumntype{L}{>{\RaggedRight\hspace{0pt}\arraybackslash}l}
  \newcolumntype{Y}{>{\RaggedRight\hspace{0pt}\arraybackslash}X}
  \newcolumntype{d}[1]{>{\DC@{.}{,}{#1}}l<{\DC@end}}
  }
  {}



\endinput

I also don't really need all the features. So it would be nice to reduce it to minimal features, which are needed..

Best Answer

The optional argument to \ProvidesPackage must be of the form

[yyyy/mm/dd Additional info]

for instance

\ProvidesPackage{tahbiblatex}[2012/04/10, by tah modified by sm and egreg]

In particular, one digit numbers of days or months must be prefixed by 0 and the year must be in four digit form. So January 2nd, 2013 has to be expressed as

2013/01/02

Turning to the package's contents, all which regards \pdfoutput is wrong: require the package ifpdf and use the \ifpdf conditional it provides. Here's an amended version; notice that allocating a counter for each option is wasting resources:

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tahbiblatex}[2012/04/10, by tah modified by sm]

\RequirePackage{ifpdf}

\DeclareOption{latin1}{\PassOptionsToPackage{\CurrentOption}{inputenc}}
\DeclareOption{applemac}{\PassOptionsToPackage{\CurrentOption}{inputenc}}
\DeclareOption{cp850}{\PassOptionsToPackage{\CurrentOption}{inputenc}}
\DeclareOption{utf8}{\PassOptionsToPackage{\CurrentOption}{inputenc}}

\DeclareOption{dvi}{\pdfoutput=\z@\pdffalse}
\DeclareOption{grafiken}{\let\tah@grafiken=T}
\DeclareOption{randausgleich}{\let\tah@randausgleich=T}
\DeclareOption{tabellen}{\let\tah@tabellen=T}
\DeclareOption{sync}{\let\tah@sync=T}

\ProcessOptions\relax

\RequirePackage{fixltx2e}
\RequirePackage{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[T1]{url}
\RequirePackage{setspace}
\RequirePackage{textcomp}

\newcommand{\urlangabe}[2]{%
  $\langle$\url{#1}$\rangle$ -- Zugriff am #2}

\def\hierlockern {\begingroup \def\par{\endgraf\endgroup}%
  \tolerance 1414
  \hbadness 1414
  \emergencystretch 1.5em
  \hfuzz 0.3pt
  \vfuzz \hfuzz
  \raggedbottom
}

\newcommand{\alleslockern}{%
  \tolerance 1414
  \hbadness 1414
  \emergencystretch 1.5em
  \hfuzz 0.3pt
  \vfuzz \hfuzz
  \raggedbottom
}

\ifdefined\tah@grafiken
  \typeout{Paket tah Meldung: Die Option `grafiken' fuer 
    \ifpdf PDF\else DVI\fi\space wurde gewaehlt.}
\fi

\ifdefined\tah@sync
  \ifpdf
    \RequirePackage{pdfsync}
    \typeout{Paket tah Meldung: Die Option `sync' fuer PDF wurde gewaehlt.}
  \else
    \RequirePackage{srcltx}
    \typeout{Paket tah Meldung: Die Option `sync' fuer DVI wurde gewaehlt.}%
  \fi
\fi

\ifdefined\tah@randausgleich
  \typeout{Paket tah Meldung: Die Option `randausgleich' wurde gewaehlt.}
  \RequirePackage{microtype}
\fi

\ifdefined\tah@tabellen
  \typeout{Paket tah Meldung: Die Option `tabellen' wurde gewaehlt.}
  \RequirePackage{tabularx}
  \RequirePackage{ragged2e}
  \RequirePackage{dcolumn}
  \RequirePackage{booktabs}
  \newcolumntype{L}{>{\RaggedRight\hspace{0pt}\arraybackslash}l}
  \newcolumntype{Y}{>{\RaggedRight\hspace{0pt}\arraybackslash}X}
  \newcolumntype{d}[1]{>{\DC@{.}{,}{#1}}l<{\DC@end}}
\fi

\endinput

I don't recommend loading the pdfsync package: the SyncTeX technology is way better, nowadays. Instead of pdfcprot the more powerful microtype package is preferable.