翌営業日を計算するパッケージまたはマクロ?

翌営業日を計算するパッケージまたはマクロ?

翌営業日を計算するパッケージまたはマクロが既存のパッケージにありますか?今日から何営業日目(休日リストを考慮)ですか、それとも任意の日付ですか?(ない場合は、ようやく何かをコード化して CTAN に投稿できると思います)

答え1

すべてを実行するパッケージは知りませんが、pgfカレンダーパッケージはかなり強力です。次のMWEは翌営業日を処理します(1週間の休日がないと仮定)

\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}

このアプローチを拡張して、n 営業日目を処理できるようにすることも可能です。

関連情報