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.

Sorry for the long post, but I give up... after hours of trying to figure out why this thing is not working, I'll be grateful if Anyone could help!

I am following the Tutorial #6, in TikZ and PGF manual.

Here is my result: enter image description here

Here is how it SHOULD look like: enter image description here Problems:

  1. Stupid %mt shows up right in the middle! No month names anywhere!
  2. My background area is too narrow.
  3. The output is on the SECOND page (first page is empty).
  4. Probably more problems - but I'd be happy to at least solve one of them.

Here is my complete code:

\documentclass[a4paper]{article}%
\usepackage{tikz}
\usetikzlibrary{mindmap, trees, calendar, shadows, backgrounds, calendar}

\begin{document}
% Define macro for annotations
% #1 - number of the lecture
% #2 - name of the lecture
% #3 - positioning options, like 'above'
% #4 - position where node is placed
% #5 - list of items to be shown
% #6 - date when the lecture will be held
\def\lecture#1#2#3#4#5#6{
    \node[annotation, #3, scale=0.65, text width=4cm, inner sep=2mm] at (#4) {
        Lecture #1: \textcolor{orange}{\textbf{#2}}
        \list{--}{\topsep=2pt\itemsep=0pt\parsep=0pt
        \parskip=0pt\labelwidth=8pt\leftmargin=8pt
        \itemindent=0pt\labelsep=2pt}
        #5
        \endlist
    };
    % Place in calendar
    \node [anchor=base west] at (cal-#6.base east) {\textcolor{orange}{\textbf{#2}}};
}
\noindent
\begin{tikzpicture}
    \begin{scope}[mindmap,
        % set every node to be a concept node!
        every node/.style ={concept, circular drop shadow, execute at begin node=\hskip0pt},
        root concept/.append style={concept color=black, line width=1ex, fill=white, text=black, font=\large\scshape},
        text=white,
        % define different colors
        styleA/.style={concept color=red,faded/.style={concept color=red!50}},
        styleB/.style={concept color=blue,faded/.style={concept color=blue!50}},
        styleC/.style={concept color=orange,faded/.style={concept color=orange!50}},
        styleD/.style={concept color=green!50!black,faded/.style={concept color=green!50!black!50}},
        grow cyclic,
        level 1/.append style={level distance=4.5cm, sibling angle=90},
        level 2/.append style={level distance=3cm, sibling angle=45, font=\scriptsize}
    ]
    \node [root concept]  (CompSci) {CompSci} % root
        child [styleA] { node (Hard Ware) {Hard Ware}
                    child {node {nodes} }
                    child [faded] {node {in} }
                    child {node {first} }
                    child {node {tree} }
        }
        child [styleB] { node (Lower Part) {Lower Part}
                child {node {nodes} }
                child {node {in} }
                child [faded] {node {first} }
                child {node {tree} }
        }
        child [styleC] { node (Robot) {Robot}
                child {node {nodes} }
                child [faded] {node {in} }
                child {node {first} }
                child {node {tree} }
        }
        child [styleD] { node (Head) {Head}
                    child [faded] {node {secondary} }
                    child {node {tree} }
                    child {node {nodes} }
        };

    \end{scope}

    % Calendar
    \tiny
    \calendar [day list downward,
                month text=\%mt\ \%y0,
                month yshift=3.5em,
                name=cal,
                at={(-.5\textwidth-5mm,.5\textheight-1cm)},
                dates=2009-04-01 to 2009-06-last]
    if (weekend)
        [black!25];
    if (day of month=1){
        \node at (0pt,1.5em) [anchor=base west] {\small\tikzmonthtext};
    };

    \lecture{1}{Hardware topics}{above,xshift=-5mm,yshift=5mm}
    {Hard Ware.north}
    {
        \item Hardware introduction
        \item Blah introduction
        \item More blah introduction
    }{2009-04-08}

    \begin{pgfonlayer}{background}
        % Clip the background so as not to enlarge the page
        \clip[xshift=-1cm] (-.5\textwidth,-.5\textheight) rectangle ++(\textwidth,\textheight);
        \colorlet{upperleft}{green!50!black!25}
        \colorlet{upperright}{orange!25}
        \colorlet{lowerleft}{red!25}
        \colorlet{lowerright}{blue!25}
        % The large rectangles
        \fill [upperleft] (CompSci) rectangle ++ (-20, 20);
        \fill [upperright] (CompSci) rectangle ++(20, 20);
        \fill [lowerleft] (CompSci) rectangle ++(-20, -20);
        \fill [lowerright] (CompSci) rectangle ++(20, -20);

        % the shadings
        \shade [left color=upperleft,right color=upperright]
            ([xshift=-1cm]CompSci) rectangle ++(2,20);
        \shade [left color=lowerleft, right color=lowerright]
            ([xshift=-1cm]CompSci) rectangle ++(2, -20);
        \shade [top color=upperleft,bottom color=lowerleft]
            ([yshift=-1cm]CompSci) rectangle ++(-20, 2);
        \shade [top color=upperright, bottom color=lowerright]
            ([yshift=-1cm]CompSci) rectangle ++(20,2);
    \end{pgfonlayer}

\end{tikzpicture}
\end{document}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Problems 2) and 3) are caused by the tikzpicture being too large for the page; you can solve this problem either by changing the margins (as I did in my example code) or by reducing the size of the tikzpicture. Problem 1) will be solved (as drozzy comments) by deleting an spurious semicolon after if(weekend)[black!25]:

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{mindmap, trees, calendar, shadows, backgrounds, calendar}
\usepackage[margin=2cm]{geometry}
\begin{document}
% Define macro for annotations
% #1 - number of the lecture
% #2 - name of the lecture
% #3 - positioning options, like 'above'
% #4 - position where node is placed
% #5 - list of items to be shown
% #6 - date when the lecture will be held
\def\lecture#1#2#3#4#5#6{
    \node[annotation, #3, scale=0.65, text width=4cm, inner sep=2mm] at (#4) {
        Lecture #1: \textcolor{orange}{\textbf{#2}}
        \list{--}{\topsep=2pt\itemsep=0pt\parsep=0pt
        \parskip=0pt\labelwidth=8pt\leftmargin=8pt
        \itemindent=0pt\labelsep=2pt}
        #5
        \endlist
    };
    % Place in calendar
    \node [anchor=base west] at (cal-#6.base east) {\textcolor{orange}{\textbf{#2}}};
}
\noindent
\begin{tikzpicture}
    \begin{scope}[mindmap,
        % set every node to be a concept node!
        every node/.style ={concept, circular drop shadow, execute at begin node=\hskip0pt},
        root concept/.append style={concept color=black, line width=1ex, fill=white, text=black, font=\large\scshape},
        text=white,
        % define different colors
        styleA/.style={concept color=red,faded/.style={concept color=red!50}},
        styleB/.style={concept color=blue,faded/.style={concept color=blue!50}},
        styleC/.style={concept color=orange,faded/.style={concept color=orange!50}},
        styleD/.style={concept color=green!50!black,faded/.style={concept color=green!50!black!50}},
        grow cyclic,
        level 1/.append style={level distance=4.5cm, sibling angle=90},
        level 2/.append style={level distance=3cm, sibling angle=45, font=\scriptsize}
    ]
    \node [root concept]  (CompSci) {CompSci} % root
        child [styleA] { node (Hard Ware) {Hard Ware}
                    child {node {nodes} }
                    child [faded] {node {in} }
                    child {node {first} }
                    child {node {tree} }
        }
        child [styleB] { node (Lower Part) {Lower Part}
                child {node {nodes} }
                child {node {in} }
                child [faded] {node {first} }
                child {node {tree} }
        }
        child [styleC] { node (Robot) {Robot}
                child {node {nodes} }
                child [faded] {node {in} }
                child {node {first} }
                child {node {tree} }
        }
        child [styleD] { node (Head) {Head}
                    child [faded] {node {secondary} }
                    child {node {tree} }
                    child {node {nodes} }
        };

    \end{scope}

    % Calendar
    \tiny
    \calendar [day list downward,
                month text=\%mt\ \%y0,
                name=cal,
                at={(-.5\textwidth-5mm,.5\textheight-1cm)},
                dates=2009-04-01 to 2009-06-last]
    if (weekend)
        [black!25]
    if (day of month=1){
        \node at (0pt,1.5em) [anchor=base west] {\small\tikzmonthtext};
    };

    \lecture{1}{Hardware topics}{above,xshift=-5mm,yshift=5mm}
    {Hard Ware.north}
    {
        \item Hardware introduction
        \item Blah introduction
        \item More blah introduction
    }{2009-04-08}

    \begin{pgfonlayer}{background}
        % Clip the background so as not to enlarge the page
        \clip[xshift=-1cm] (-.5\textwidth,-.5\textheight) rectangle ++(\textwidth,\textheight);
        \colorlet{upperleft}{green!50!black!25}
        \colorlet{upperright}{orange!25}
        \colorlet{lowerleft}{red!25}
        \colorlet{lowerright}{blue!25}
        % The large rectangles
        \fill [upperleft] (CompSci) rectangle ++ (-20, 20);
        \fill [upperright] (CompSci) rectangle ++(20, 20);
        \fill [lowerleft] (CompSci) rectangle ++(-20, -20);
        \fill [lowerright] (CompSci) rectangle ++(20, -20);

        % the shadings
        \shade [left color=upperleft,right color=upperright]
            ([xshift=-1cm]CompSci) rectangle ++(2,20);
        \shade [left color=lowerleft, right color=lowerright]
            ([xshift=-1cm]CompSci) rectangle ++(2, -20);
        \shade [top color=upperleft,bottom color=lowerleft]
            ([yshift=-1cm]CompSci) rectangle ++(-20, 2);
        \shade [top color=upperright, bottom color=lowerright]
            ([yshift=-1cm]CompSci) rectangle ++(20,2);
    \end{pgfonlayer}

\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
I found what they did for page sizing: \usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geo‌​metry} . Interesting how they used it in their typeset document - but it's nowhere to be found in examples, eh? –  drozzy Mar 28 '12 at 2:13
    
The other problem, it seems, was that I had a semicolon after if(weekend)[black!25] statement, whereas there should not be one there... –  drozzy Mar 28 '12 at 2:21
    
@drozzy: you're right.I've updated my answer. –  Gonzalo Medina Mar 28 '12 at 2:58
add comment

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.