Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I’ve produced the calendar below with TikZ but I think the colourings need to be made more salient by shading a box around the coloured dates (as there will be four of these years on a page and the colouring gets drowned out). How can I do that?

\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}
share|improve this question
    
How can you do what? You could a) use another color, b) use a filling, c) use \contour. –  Qrrbrbirlbel Oct 4 '13 at 23:30

1 Answer 1

up vote 6 down vote accepted

Would this be salient enough?

Code

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

Output

enter image description here

share|improve this answer
    
Perfect. Thanks. I won't grey fill the Sundays, but otherwise, that's exactly what I wanted. –  Daniel Harbour Oct 5 '13 at 1:11
    
Why do I get an error message when I replace \documentclass[12pt,tikz]{standalone} with \documentclass[12pt]{article} \usepackage{tikz}? I'd prefer to stick with article as my document class for the moment. –  Daniel Harbour Oct 5 '13 at 10:45
    
The code that causes the error message is days={ ... }. But, commenting it out, you get white space around single-digit days, instead of the continuous box you get with two-digit days. A fast and nasty work around is to replace it with day text=\%d0, making all days two digits long. –  Daniel Harbour Oct 5 '13 at 11:08
    
@DanielHarbour The standalone class uses article internally; it is only used in my example to reduce the code to the TikZ example. I don’t get an error with \documentclass[12pt]{article}\usepackage{tikz}. What do you get? Feel free to ask a follow-up question. –  Qrrbrbirlbel Oct 5 '13 at 18:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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