I'm starting with these examples:

I'm looking to add a red bar under and possibly through the numbers indicating a multiday event. I'm interested in how to do this both within a week, and also over weekends (where wraparound would be an issue).

1 Answer 1


This is not an answer but an attempt to clarify your question. All I did was to copy the code from your second link and to add some basic thingy that I adapted drom p. 526 of the pgfmanual. This allows me to draw a red bar.

% An example how to use the calendar library and modify the layout, i.e. put
% Sunday as the first week day.
% Author: Berteun Damman

    % This way you can define your own conditions, for example, you
    % could make something as `full moon', `even week', `odd week',
    % et cetera. In principle. The math in TeX could be hard.
    \pgfkeys{/pgf/calendar/start of year/.code={%

    % Define our own style
    \tikzstyle{week list sunday}=[
        % Note that we cannot extend from week list,
        % the execute before day scope is cumulative
        execute before day scope={%
               \ifdate{day of month=1}{\ifdate{equals=\pgfcalendarbeginiso}{}{
               % On first of month, except when first date in calendar.
        execute at begin day scope={%
            % Because for TikZ Monday is 0 and Sunday is 6,
            % we can't directly use \pgfcalendercurrentweekday,
            % but instead we define \c@pgf@counta (basically) as:
            % (\pgfcalendercurrentweekday + 1) % 7
                \advance\c@pgf@counta by 1
            % Shift to the right position for the day.
        execute after day scope={
            % Week is done, shift to the next line.
        % This should be defined, glancing from the source code.

    % New style for drawing the year, it is always drawn
    % for January
    \tikzstyle{year label left}=[
        execute before day scope={
            \ifdate{start of year}{
        % Right align
        every year/.append style={

    % Style to force giving a month a year label.
    \tikzset{draw year/.style={
        execute before day scope={
            \ifdate{day of month=1}{\drawyear}{}

    % This actually draws the year.
        % \tikzyearcode is defined by default


    % The actual calendar is now rather easy:
    \begin{tikzpicture}[every calendar/.style={
            month label above centered,
            month text={\textit{\%mt}},
            year label left,
            every year/.append style={font=\Large\sffamily\bfseries,
            if={(Sunday) [blue!70]},
            week list sunday,
        \matrix[column sep=1em, row sep=1em] {
            \calendar[dates=2018-04-01 to 2018-04-last,draw year]; &
            \calendar[dates=2018-05-01 to 2018-05-last]; &
            \calendar[dates=2018-06-01 to 2018-06-last]; \\
            \calendar[dates=2018-07-01 to 2018-07-last]; &
            \calendar[dates=2018-08-01 to 2018-08-last]; &
            \calendar (mycal) [dates=2018-09-01 to 2018-09-last]; \\
            \calendar[dates=2018-10-01 to 2018-10-last]; &
            \calendar[dates=2018-11-01 to 2018-11-last]; &
            \calendar[dates=2018-12-01 to 2018-12-last]; \\
            \calendar[dates=2019-01-01 to 2019-01-last]; &
            \calendar[dates=2019-02-01 to 2019-02-last]; &
            \calendar[dates=2019-03-01 to 2019-03-last]; \\
    \draw[red] (mycal-2018-09-20.south west) -- (mycal-2018-09-22.south east);  
    \draw[red] (mycal-2018-09-23.south west) -- (mycal-2018-09-24.south east);  

enter image description here

Is your question how to replace the two draw commands by a single macro?

  • Thank you, that does essentially answer my question: I was unfamiliar with the syntax for: \draw[red] (mycal-2018-09-23.south west) -- (mycal-2018-09-24.south east); Any chance you could also point me to how I could make the line thicker and change its height? I saw I could use \draw[red] (oct-2018-10-08.mid west) -- (oct-2018-10-12.mid east); the mid command, but I'm looking for something like north-north-mid. Sep 20, 2018 at 2:45
  • 1
    @Mittenchops You can choose the line width to be e.g. thick, \draw[red,thick]... or ultra thick, or say \draw [line width=2pt,red]..... Then, if you say \draw[red,very thick] ([yshift=2pt]mycal-2018-09-20.south west) -- ([yshift=2pt]mycal-2018-09-22.south east); this will move the line up by 2pt, if you use -2pt it will move down by the same amount. I also think it will be not too difficult do define a style/macro for that. So if you append some information what you precisely want to your nice question (and ping me again) I'll be happy to give it a shot.
    – user121799
    Sep 20, 2018 at 2:50

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.