2

In LaTeX, I'd like to generate a sequence of dates, which repeats on Monday and Wednesday every week. The sequence should look like:

Mon 3/30
Wed 4/1
Mon 4/6
Wed 4/8
...

I have tried to use the datenumber package in LaTeX but to no avail. I would appreciate any help how to approach this problem. Thank you!

I have tested the program below:

\setdate{2015}{3}{30}
\newcommand{\pnext}{%
\thedateyear/%
\ifnum\value{datemonth}<10 0\fi
\thedatemonth/%
\ifnum\value{dateday}<10 0\fi
\thedateday%
%\addtocounter{dateday}{1}
\setcounter{dateday}{4}
\nextdate
}
\pnext, \pnext, \pnext, \pnext, \pnext

However, the output is:

2015/03/30 , 2015/03/05 , 2015/03/05 , 2015/03/05 , 2015/03/05

jackyd
  • 23

1 Answers1

3

You should consider using advdate to advance dates:

March 30, 2015
April 2, 2015
April 6, 2015
April 9, 2015
April 13, 2015
April 16, 2015

\documentclass{article}
\usepackage{advdate}

\newif\iffirst
\newcommand{\pnext}{%
  \AdvanceDate[3]% Step 3 days ahead...
  \iffirst
    \AdvanceDate\global\firstfalse% ...maybe 4
  \else
    \global\firsttrue
  \fi
  \today
}

\begin{document}

\ThisYear{2015}\ThisMonth{3}\ThisDay{30}% Set date to March 30, 2015
\today\par
\pnext\par
\pnext\par
\pnext\par
\pnext\par
\pnext

\end{document}

You can adjust the output of \today by reading up on Date format in LaTeX.

Werner
  • 603,163
  • @jackyd: I've updated the answer slightly to use an alternating step (3 or 4 days). In your case, you're probably interested in a 2-day/5-day stepping pattern to retrieve a Mon/Wed schedule. – Werner Mar 31 '15 at 14:54