Tikz 日历:无日移的月份列表

Tikz 日历:无日移的月份列表

我正在尝试获取月份列表,但不要求每列中的天数位于一周中的同一天。我在手册中找不到默认月份列表样式的此选项,如果我从手册中的月份列表排列示例中选择,我会丢失一些硬编码到默认样式的样式。

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

有什么建议么?

谢谢。

答案1

在源代码中,\tikz@lib@cal@month@list@start如果星期五是该月的第一天,则为 5;\pgf@xa是天数之间的距离,因此使用负值校正即可。

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

相关内容