
¿Existe un paquete o macro en un paquete existente que se calculará el siguiente día hábil onorte¿El enésimo día hábil (teniendo en cuenta una lista de días festivos) a partir de hoy o una fecha arbitraria? (Si no lo hay, supongo que finalmente tendré algo que codificar y publicar en CTAN)
Respuesta1
No conozco un paquete que lo haga todo, pero elpgfcalendarioEl paquete es bastante poderoso. El siguiente MWE maneja el siguiente día hábil (suponiendo que no haya una semana completa de feriados)
\documentclass{article}
\usepackage{pgfkeys}
\usepackage{pgfcalendar}
\usepackage{etoolbox}
\newif\ifholiday
\def\holidays{2016-09-12, 2016-09-16, 2016-09-20, 2016-09-21, 2016-09-23, 2016-09-26}
\newcount\nextjulianday
\newcount\julianholiday
\newcommand{\isholiday}[2]{%
\holidayfalse%
\def\do##1{%
\pgfcalendardatetojulian{##1}{\julianholiday}%
\ifnumequal{\the\julianholiday}{\the\nextjulianday}{\holidaytrue}{}%
}%
\docsvlist{#1}%
}
\newcommand{\nextbusinessday}[1]{\begingroup%
\pgfcalendardatetojulian{#1}{\nextjulianday}%
\advance\nextjulianday 1\relax%
\loop
\expandafter\isholiday\expandafter{\holidays}{\the\nextjulianday}%
\ifholiday%
\advance\nextjulianday 1\relax%
\repeat%
\pgfcalendarjuliantodate{\the\nextjulianday}{\theyear}{\themonth}{\theday}%
\pgfcalendarifdate{\theyear-\themonth-\theday}{Saturday}{%
\advance\nextjulianday 1\relax%
\pgfcalendarjuliantodate{\the\nextjulianday}{\theyear}{\themonth}{\theday}%
}{}%
\pgfcalendarifdate{\theyear-\themonth-\theday}{Sunday}{%
\advance\nextjulianday 1\relax%
\pgfcalendarjuliantodate{\the\nextjulianday}{\theyear}{\themonth}{\theday}%
}{}%
\loop
\expandafter\isholiday\expandafter{\holidays}{\the\nextjulianday}%
\ifholiday%
\advance\nextjulianday 1\relax%
\repeat%
\pgfcalendarjuliantodate{\the\nextjulianday}{\theyear}{\themonth}{\theday}%
\theyear-\themonth-\theday
\endgroup}
\begin{document}
Holidays:
\def\do#1{#1\par}
\expandafter\docsvlist\expandafter{\holidays}
\def\do#1{2016-09-#1 -- \nextbusinessday{2016-09-#1}\par}
\docsvlist{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}
\end{document}
Debería ser posible ampliar el enfoque para gestionar el enésimo día hábil.