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 read about week list in the PGF/TikZ manual, but I couldn't find an example that arranges the days of the week vertically:

June 1997

M   2  9 16 23 30
T   3 10 17 24
W   4 11 18 25
T   5 12 19 26
F   6 13 20 27
S   7 14 21 28
S 1 8 15 22 29

Could you help me with an example of how to create a week list arrangement like this?

share|improve this question
    
Maybe also have a look at the ctan.org/pkg/calxxxx and ctan.org/pkg/calxxxx-yyyy packages. –  Stephen Jan 2 '12 at 18:02

2 Answers 2

up vote 7 down vote accepted

Here's a new style vertical week list, which is adapted from the week list style found in the TikZ source code. The day labels are adapted from the answer to Weekday captions with the TikZ library "calendar".

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calendar}

 \makeatletter
\tikzstyle{week list}=[%
  execute before day scope={%
    \ifdate{day of month=1}{\ifdate{equals=\pgfcalendarbeginiso}{}
      {%
        % On first of month, except when first date in calendar.
        \pgfmathsetlength{\pgf@x}{\tikz@lib@cal@month@xshift}%
        \pgftransformxshift{\pgf@x}
      }%
    }{}%
  }, 
  execute at begin day scope={%
    \pgfmathsetlength\pgf@y{\tikz@lib@cal@yshift}%
    \pgf@y=\pgfcalendarcurrentweekday\pgf@y%
    \pgftransformyshift{-\pgf@y}%
  },
  execute after day scope={%
    \ifdate{Sunday}{%
      \pgfmathsetlength{\pgf@x}{\tikz@lib@cal@xshift}%
      \pgftransformxshift{\pgf@x}
    }{}%
  }
]

\tikzoption{day headings}{\tikzstyle{day heading}=[#1]}
\tikzstyle{day heading}=[]
\tikzstyle{day letter headings}=[
    execute before day scope={ \ifdate{day of month=1}{%
      \pgfmathsetlength\pgf@ya{\tikz@lib@cal@yshift}%
      \pgfmathsetlength\pgf@xa{\tikz@lib@cal@xshift}%
      \pgftransformxshift{\pgf@xa}
      \foreach \d/\l in {0/M,1/T,2/W,3/T,4/F,5/S,6/S} {
        \pgf@ya=\d\pgf@ya%
        \pgftransformxshift{-\pgf@xa}%
        \pgftransformyshift{-\pgf@ya}%
        \node[every day,day heading, anchor=base]{\l};%
      } 
    }{}%
  }%
]
\makeatother


\begin{document}
\begin{tikzpicture}
\calendar[
    dates=1997-06-01 to 1997-06-last,
    week list,
    day letter headings,
    day heading/.style={gray, xshift=-1em},
    month label above left,
    month text=\%mt \%y0
];
\end{tikzpicture}
\end{document}
share|improve this answer

You could use \pgftransformyshift for shifting days down. Here's an example style arranging the days vertically:

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{calendar}
\tikzstyle{week list downward}=[%
  execute before day scope={%
    \ifdate{day of month=1}{\ifdate{equals=\pgfcalendarbeginiso}{}{%
      \pgftransformxshift{1.5em}}%
    }{}}, 
  execute after day scope={%
    \ifdate{Sunday}{%
      \pgftransformyshift{6em}
      \pgftransformxshift{1.5em}
    }{\pgftransformyshift{-1em}}},
]
\begin{document}
  \tikz\calendar [dates=2012-01-01 to 2012-03-last,week list downward];
\end{document}

weekly calender with vertically arranged days

share|improve this answer
    
Thanks, great example of \pgftransformyshift! –  Nyiti Jan 2 '12 at 10:04

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.