当突出显示日历中的范围时,我似乎无法让重叠区域像重叠不透明对象时通常发生的那样混合。例如,使用以下代码(使用 XeLaTeX 编译):
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calendar}
\begin{document}
\begin{tikzpicture}
\begin{scope}[yshift=2em]
\draw [line width=5mm, opacity=0.75] (0,1) -- (2,1);
\draw [line width=5mm, opacity=0.5] (1,0) -- (1,2);
\end{scope}
\calendar [dates=2014-02-01 to 2014-02-last,
week list,
day xshift = 2em,
day yshift = 2em,
every day/.style={anchor=center, minimum width=2em, minimum height=2em},
if={(between=2014-02-10 and 2014-02-16)[days={fill=black, text=black, fill opacity=0.75, text opacity=1}]},
if={(Wednesday) [days={fill=black, text=black, fill opacity=0.5, text opacity=1}]},
];
\end{tikzpicture}
\end{document}
我希望 12 具有与十字架中间相同的背景填充。
答案1
我从未使用过calendar
,也没有看过代码,所以我不知道如何提供解决方案。但我可以建议一种解决方法。
name=mycal
如果你在\calendar
命令中使用选项,每个日期都是一个node
带有名称的mycal-2014-02-05
。那么在完成日历后,就可以很容易地用类似
\fill[fill opacity=0.5] (mycal-2014-02-05.north west) rectangle (mycal-2014-02-26.south east);
要得到
完整代码如下
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calendar}
\begin{document}
\begin{tikzpicture}
\begin{scope}[yshift=2em]
\draw [line width=5mm, opacity=0.75] (0,1) -- (2,1);
\draw [line width=5mm, opacity=0.5] (1,0) -- (1,2);
\end{scope}
\calendar [name=mycal, dates=2014-02-01 to 2014-02-last,
week list,
day xshift = 2em,
day yshift = 2em,
every day/.style={anchor=center, minimum width=2em, minimum height=2em},
if={(between=2014-02-10 and 2014-02-16)[days={fill=black, text=black, fill opacity=0.75, text opacity=1}]},
% if={(Wednesday) [days={fill=blue, text=black, fill opacity=0.5, text opacity=1}]},
];
\fill[fill opacity=0.5] (mycal-2014-02-05.north west) rectangle (mycal-2014-02-26.south east);
\end{tikzpicture}
\end{document}