3

I'm trying to get a month list without the requirement of days in each column lie on the same day of week. I could't find this option for the default month list style in the manual and if I pick up from the month list arrangement example from the manual, I loose some of the styling hard-coded to the default style.

\documentclass[]{article}

\usepackage{pdflscape}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shapes.multipart,calendar}

\begin{document}

\begin{landscape}
\begin{figure}[]
\centering
\begin{tikzpicture}
[every day/.style={anchor=mid},
every node/.style={inner sep=2pt,rectangle,thick}]
\calendar (cal) [dates=2014-12-01 to 2016-06-last, month list, month label left,
month text=\textcolor{black}{\%mt}, month yshift=1.5em, black!20
];
\end{tikzpicture}
\caption{Plan For The Proposed Research}
\label{fig:researchPlan}
\end{figure}
\end{landscape}

\begin{landscape}
\begin{figure}[]
\centering
\begin{tikzpicture}
[every day/.style={anchor=mid},
every node/.style={inner sep=2pt,rectangle,thick}]
\newcount\mycount
\tikz
\calendar
[dates=2000-01-01 to 2000-02-last,month label left, 
month text=\textcolor{black}{\%mt}, month yshift=1.5em, black!20,
execute before day scope=
{
\ifdate{day of month=1} {
% Remember the weekday of first day of month
\mycount=\pgfcalendarcurrentweekday
% Shift downward
\pgftransformyshift{-1em}
}{}
},
execute at begin day scope=
{
% each day is shifted right according to the day of month
\pgftransformxshift{\pgfcalendarcurrentday em}
% and additionally according to the weekday of the first
%\pgftransformxshift{\the\mycount em}
}];

\end{tikzpicture}
\caption{Plan For The Proposed Research}
\label{fig:researchPlan2}
\end{figure}
\end{landscape}

\end{document}

Any suggestions?

Thanks.

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Nov 12 '14 at 16:17
0

In the source code, \tikz@lib@cal@month@list@start is 5 if Friday is the first day of the month; and \pgf@xa is the distance between days, so a negative correction will do the trick.

\documentclass[border=9,tikz]{standalone}
    \usetikzlibrary{calendar}
\begin{document}
    \makeatletter
    \tikzset{
        month list'/.style={
            month list,
            execute at begin day scope={
                \pgftransformxshift{-\tikz@lib@cal@month@list@start\pgf@xa}
            },
            month label left,
            month yshift=1.5em
        }
    }
    \begin{tikzpicture}
        \calendar (cal)[dates=2014-12-01 to 2016-06-last,month list'];
    \end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.