TikZ 日历中的阴影

TikZ 日历中的阴影

我用 TikZ 制作了下面的日历,但我认为需要通过在彩色日期周围加一个阴影框来使颜色更加突出(因为一页中有四个年份,颜色会被淹没)。我该怎么做?

\documentclass[12pt]{article}
\usepackage{mathptmx}
\usepackage{tikz}
\usetikzlibrary{calendar}    
\begin{document}
\begin{figure}
\sffamily\scriptsize
\begin{center}
\makebox[0pt]{\tikz
\colorlet{darkgreen}{green!60!black}
\calendar [dates=2012-01-01 to 2012-12-31,
month list,month label left,month yshift=1.25em]
if (Sunday) [black!50]
% GROUP 1
if (between=2012-08-09 and 2012-08-12)[orange]
if (between=2012-06-01 and 2012-06-03)[orange]
if (between=2012-04-05 and 2012-04-07)[orange]
if (between=2012-12-22 and 2012-12-27)[orange]
% GROUP 2
if (between=2012-09-10 and 2012-09-15)[blue] 
if (between=2012-08-17 and 2012-08-21)[blue] 
if (between=2012-06-29 and 2012-07-02)[blue] 
if (between=2012-05-14 and 2012-05-21)[blue] 
% GROUP 3
if (between=2012-11-02 and 2012-11-09)[darkgreen] 
if (between=2012-01-01 and 2012-01-27)[darkgreen] 
;}
\end{center}
\end{figure}\end{document}

答案1

这够明显吗?

代码

\documentclass[12pt,tikz]{standalone}
\usepackage{mathptmx}
\usetikzlibrary{calendar}
\begin{document}
\sffamily\scriptsize
\tikz
\colorlet{darkgreen}{green!60!black}
\calendar [
  dates=2012-01-01 to 2012-12-31,
  month list, month label left, month yshift=1.25em,
  days={
    text width=width("00"),
    align=right,
    inner xsep=
      .5*\csname tikz@lib@cal@xshift\endcsname-.5*\csname tikz@text@width\endcsname,
    inner ysep=.5*\csname tikz@lib@cal@month@yshift\endcsname-.5*height("0")}
]
if (Sunday) [days={fill=black!50}]
% GROUP 1
if (between=2012-08-09 and 2012-08-12)[days={fill=orange}]
if (between=2012-06-01 and 2012-06-03)[days={fill=orange}]
if (between=2012-04-05 and 2012-04-07)[days={fill=orange}]
if (between=2012-12-22 and 2012-12-27)[days={fill=orange}]
% GROUP 2
if (between=2012-09-10 and 2012-09-15)[days={fill=blue,text=white}]
if (between=2012-08-17 and 2012-08-21)[days={fill=blue,text=white}]
if (between=2012-06-29 and 2012-07-02)[days={fill=blue,text=white}]
if (between=2012-05-14 and 2012-05-21)[days={fill=blue,text=white}]
% GROUP 3
if (between=2012-11-02 and 2012-11-09)[days={fill=darkgreen}]
if (between=2012-01-01 and 2012-01-27)[days={fill=darkgreen}]
;
\end{document}

输出

在此处输入图片描述

相关内容