按照 Tikz 和 Pgf 手册,思维导图教程 - 添加日历后,思维导图消失了!
有人有这些例子的完整 LaTeX 代码吗?真是令人沮丧……
这是我的代码:
\documentclass{article}%
\usepackage{tikz}
\usetikzlibrary{mindmap, trees, calendar, shadows, backgrounds, calendar}
% 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}}};
}
\begin{document}
\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-05-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=-3mm}
{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}
输出如下:
答案1
问题出在这行:
at={(-5.\textwidth-5mm,.5\textheight-1cm)},
当然 - 这只是一个简单的点,放错了位置:-5.
而不是-.5
:
at={(-.5\textwidth-5mm,.5\textheight-1cm)},
可惜没有错误消息可以阻止这种事情发生。
zip
另外,可以在下载文件中找到示例的源代码,doc/generic/pgf/text-en
在我的例子中,该文件名为pgfmanual-en-tutorial-map.text
。