paquete [fecha y hora] no funciona con

paquete [fecha y hora] no funciona con

A continuación se muestra un SSCCE:

\documentclass{report}

\usepackage{datetime}
%\usepackage{titling} %if this line is uncommented compilation fails

\begin{document}
\newdate{date2}{08}{02}{2015}
\date{\displaydate{date2}}
foo
\end{document}

... el código anterior se compila, pero si la línea que llama en el titlingpaquete no está comentada, la compilación falla con:

pdflatex esa-sre-gedais-sdp.tex
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(./esa-sre-gedais-sdp.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/report.cls
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf-texlive/tex/latex/datetime/datetime.sty
(/usr/share/texmf-texlive/tex/latex/fmtcount/fmtcount.sty
(/usr/share/texmf-texlive/tex/latex/base/ifthen.sty)
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty)
(/usr/share/texmf-texlive/tex/latex/fmtcount/fc-english.def)
(/usr/share/texmf-texlive/tex/latex/fmtcount/fc-USenglish.def)
No configuration file fmtcount.cfg found.
)) (/usr/share/texmf-texlive/tex/latex/titling/titling.sty)
(./esa-sre-gedais-sdp.aux))
! Incomplete \iffalse; all text was ignored after line 8.
<inserted text> 
                \fi 
<*> esa-sre-gedais-sdp.tex

? X
No pages of output.
Transcript written on esa-sre-gedais-sdp.log.
make: *** [all] Error 1

Respuesta1

No tengo idea de qué hace ninguno de los paquetes, pero en caso de duda, agregue \protect. Esto se ejecuta sin errores:

\documentclass{report}

\usepackage{datetime}
\usepackage{titling} %if this line is uncommented compilation fails

\begin{document}
\newdate{date2}{08}{02}{2015}
\date{\protect\displaydate{date2}}
foo
\end{document}

Respuesta2

El datetimepaquete tiene una opción peculiar sobre qué comandos deben ser robustos o no. Por ejemplo \longdate, declara \shortdatey comandos similares como robustos (probablemente no deberían), pero no hace lo mismo que \displaydateprobablemente se use para mover argumentos.

Entonces el paquetedeberíahacer

\DeclareRobustCommand*{\displaydate}[1]{%
\@ifundefined{date@#1@y}{%
\PackageError{datetime}{Date `#1' not defined}{}}{%
\formatdate{\csname date@#1@d\endcsname}{%
\csname date@#1@m\endcsname}{%
\csname date@#1@y\endcsname}}}

porque este comando usa \formatdateel cual realiza asignaciones y no se declara como robusto cuando (re)definido (también \PackageErrores el culpable). Lamentablemente, el paquete utiliza \newcommanden su lugar.

Puedes solucionar el problema con etoolbox:

\documentclass{report}

\usepackage{etoolbox}
\usepackage{datetime}
\usepackage{titling} %if this line is uncommented compilation fails

\robustify{\displaydate} % make \displaydate robust

\begin{document}
\newdate{date2}{08}{02}{2015}

\title{Title}
\author{Author}
\date{\displaydate{date2}}

\maketitle

foo

\end{document}

e informe esto al autor del paquete.

ingrese la descripción de la imagen aquí

información relacionada