I have a problem with the following code. Although I manage to write the number of the week in front of the corresponding Monday, I am unable to use this number to write if the week in question is a member of a given list of weeks.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{xparse,expl3}
\usetikzlibrary{calendar}
\usepackage[landscape,margin=.5cm]{geometry}
\ExplSyntaxOn
\NewDocumentCommand{\pgfcalendarcurrentweek}{}
{
\pgfcalendardatetojulian{\pgfcalendarcurrentyear-01-01}{\l_tmpb_int}
\int_eval:n{(\pgfcalendarcurrentjulian-\l_tmpb_int)/7+1}
}
\begin{document}
\seq_new:N\g_foo_weeks_seq
\seq_set_from_clist:Nn\g_foo_weeks_seq{36,38}
%Calendrier
\begin{tikzpicture}
\calendar[
dates=17-09-01 to 17-09-30,
name=cal,
execute~at~begin~day~scope=
{
% each day is shifted down according to the day of month
\pgftransformyshift{-.5*\pgfcalendarcurrentday cm}
},
day~code=
{
\node[name=\pgfcalendarsuggestedname,every~day,shape=rectangle,minimum~height=.5cm, text~width =.5cm]{\tikzdaytext};
\draw[anchor=west] (0,3pt) node{\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}};
\ifdate{Monday}
{
\node[circle,gray,inner~sep=0,anchor=east] at (-.7cm,3pt) {\pgfcalendarcurrentweek};
}{}
% The following part does not work as I intend
\ifdate{Tuesday}
{
\cs_generate_variant:Nn\seq_if_in:NnTF {NfTF}
\seq_if_in:NxTF\g_foo_weeks_seq\pgfcalendarcurrentweek
{
\node[circle,gray,inner~sep=0,anchor=east] at (-.7cm,3pt) {Yes};
}
{
\node[circle,gray,inner~sep=0,anchor=east] at (-.7cm,3pt) {No};
}
}
}
];
\end{tikzpicture}
\ExplSyntaxOff
\end{document}
\cs_generate_variant:Nn
should definitely go outside the code for the picture – egreg Sep 24 '17 at 10:58\pgfcalendarcurrentweek
doesn't expand to a number (it can't be used in an expansion context at all, it makes assignments), follow the model of\pgfcalendarcurrentyear-01-01}{\l_tmpb_int}
and leave the result in a macro that you can use to expand to the week number – David Carlisle Sep 24 '17 at 10:59