
다음 영업일을 계산하는 패키지나 매크로가 기존 패키지에 있습니까?N오늘부터 영업일 기준 1일(공휴일 목록 고려)입니까, 아니면 임의의 날짜입니까? (만약 없다면, 마침내 코드를 작성하여 CTAN에 게시할 내용이 생길 것 같습니다.)
답변1
모든 기능을 갖춘 패키지는 모르지만pgfcalendar패키지는 꽤 강력합니다. 다음 MWE는 다음 영업일을 처리합니다(일주일 내내 휴일이 없다는 가정).
\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번째 영업일을 처리하는 방식으로 확장이 가능해야 합니다.