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'm making a calendar in LaTeX with tikz-pgf and I would like to set to gray the background color for the weekend. In the examples I found on the Internet and in the documentation, I can see how to setup the foreground color:

if (weekend) [red]

but something like this does not work

if (weekend) [fill=gray]

This is my code:

\begin{tikzpicture}
    \calendar(mycal) [dates=2013-09-01 to 2013-09-last, 
        week list, 
        month label above centered,
        month text=\%mt \%y0    
        ]
        if (Sunday) [red]
    if (weekend) [fill=gray];

\end{tikzpicture}
share|improve this question
3  
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces or enclose words in backticks `, they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). –  Marco Daniel Apr 27 '13 at 15:52
1  
I can't find it in the documentation but if (weekend) [nodes={fill=gray}] fills the nodes. –  Mark Wibrow Apr 27 '13 at 19:33
1  
@MarkWibrow This is pretty much the same as if (weekend) [every day/.append style={fill=gray}] as the nodes key just appends its argument to the every node style. –  Qrrbrbirlbel Apr 27 '13 at 19:47
    
Thanks, this works almost as I need. There is a way to expand the background's width a little bit, so that e.g. both "8" and "23" background's width are the same? –  FloDD Apr 27 '13 at 19:52
1  
@FloDD Have you seen my comment on MarcoDaniel’s answer? You might need to reduce the text width a little bit, because the nodes overlap slightly. –  Qrrbrbirlbel Apr 27 '13 at 19:56

1 Answer 1

up vote 2 down vote accepted

@everyone Solved in this way:

\begin{tikzpicture}
    \calendar [dates=2013-09-01 to 2013-09-last,
        week list,
        month label above centered,
        month text=\%mt \%y0
    ]
    if (Sunday) [red]
    if (weekend) [nodes={fill=black!20,minimum size=1.7em}];
\end{tikzpicture}
share|improve this answer

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.