3

When highlighting ranges in a calendar, I can't seem to get the overlapping area to blend as would normally happen with overlapping opaque objects. For example using the following code (compiled with 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}

I would like the 12 to have the same background fill as the middle of the cross. enter image description here

3

I've never used calendar and haven't looked at the code, then I don't know how to provide a solution. But I can suggest a workaround.

If you use option name=mycal in \calendar command every date is a node with name mycal-2014-02-05. Then it's easy to mark dates after finishing the calendar with something like

  \fill[fill opacity=0.5] (mycal-2014-02-05.north west) rectangle (mycal-2014-02-26.south east); 

to get

enter image description here

The complete code is

\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}
  • This works, just a pity that this issue isn't handled by tikz itself. – lyineyes Jan 15 '14 at 17:35

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.