我正在寻找一些 LaTex 时间线,它看起来应该如下所示:
编辑 1:我确实检查了pgfgantt package
,但它没有提供像上面那样酷的时间线。编辑 2:最小代码来自 韓國語.pdf。第 48 页上的图表也适用于我。但我无法使用以下最少的代码重现它。
\documentclass[tikz]{standalone}
\usepackage{pgfgantt}
\title{Gantt Charts with the pgfgantt Package}
\begin{document}
%
% A fairly complicated example from section 2.9 of the package
% documentation. This reproduces an example from Wikipedia:
% http://en.wikipedia.org/wiki/Gantt_chart
%
\definecolor{barblue}{RGB}{153,204,254}
\definecolor{groupblue}{RGB}{51,102,254}
\definecolor{linkred}{RGB}{165,0,33}
\renewcommand\sfdefault{phv}
\renewcommand\mddefault{mc}
\renewcommand\bfdefault{bc}
\setganttlinklabel{s-s}{START-TO-START}
\setganttlinklabel{f-s}{FINISH-TO-START}
\setganttlinklabel{f-f}{FINISH-TO-FINISH}
\sffamily
\begin{ganttchart}[
canvas/.append style={fill=none, draw=black!5, line width=.75pt},
hgrid style/.style={draw=black!5, line width=.75pt},
vgrid={*1{draw=black!5, line width=.75pt}},
today=7,
today rule/.style={
draw=black!64,
dash pattern=on 3.5pt off 4.5pt,
line width=1.5pt
},
today label font=\small\bfseries,
title/.style={draw=none, fill=none},
title label font=\bfseries\footnotesize,
title label node/.append style={below=7pt},
include title in canvas=false,
bar label font=\mdseries\small\color{black!70},
bar label node/.append style={left=2cm},
bar/.append style={draw=none, fill=black!63},
bar incomplete/.append style={fill=barblue},
bar progress label font=\mdseries\footnotesize\color{black!70},
group incomplete/.append style={fill=groupblue},
group left shift=0,
group right shift=0,
group height=.5,
group peaks tip position=0,
group label node/.append style={left=.6cm},
group progress label font=\bfseries\small,
link/.style={-latex, line width=1.5pt, linkred},
link label font=\scriptsize\bfseries,
link label node/.append style={below left=-2pt and 0pt}
]{1}{13}
\gantttitle[
title label node/.append style={below left=7pt and -3pt}
]{WEEKS:\quad1}{1}
\gantttitlelist{2,...,13}{1} \\
\ganttgroup[progress=57]{WBS 1 Summary Element 1}{1}{10} \\
\ganttbar[
progress=75,
name=WBS1A
]{\textbf{WBS 1.1} Activity A}{1}{8} \\
\ganttbar[
progress=67,
name=WBS1B
]{\textbf{WBS 1.2} Activity B}{1}{3} \\
\ganttbar[
progress=50,
name=WBS1C
]{\textbf{WBS 1.3} Activity C}{4}{10} \\
\ganttbar[
progress=0,
name=WBS1D
]{\textbf{WBS 1.4} Activity D}{4}{10} \\[grid]
\ganttgroup[progress=0]{WBS 2 Summary Element 2}{4}{10} \\
\ganttbar[progress=0]{\textbf{WBS 2.1} Activity E}{4}{5} \\
\ganttbar[progress=0]{\textbf{WBS 2.2} Activity F}{6}{8} \\
\ganttbar[progress=0]{\textbf{WBS 2.3} Activity G}{9}{10}
\ganttlink[link type=s-s]{WBS1A}{WBS1B}
\ganttlink[link type=f-s]{WBS1B}{WBS1C}
\ganttlink[
link type=f-f,
link label node/.append style=left
]{WBS1C}{WBS1D}
\end{ganttchart}
%
% A simpler example from the package documentation:
%
\begin{ganttchart}{1}{12}
\gantttitle{2011}{12} \\
\gantttitlelist{1,...,12}{1} \\
\ganttgroup{Group 1}{1}{7} \\
\ganttbar{Task 1}{1}{2} \\
\ganttlinkedbar{Task 2}{3}{7} \ganttnewline
\ganttmilestone{Milestone}{7} \ganttnewline
\ganttbar{Final Task}{8}{12}
\ganttlink{elem2}{elem3}
\ganttlink{elem3}{elem4}
\end{ganttchart}
\end{document}
答案1
\documentclass[tikz]{standalone}
\usepackage{pgfgantt}
\title{Gantt Charts with the pgfgantt Package}
\begin{document}
%
% A fairly complicated example from section 2.9 of the package
% documentation. This reproduces an example from Wikipedia:
% http://en.wikipedia.org/wiki/Gantt_chart
%
\definecolor{barblue}{RGB}{153,204,254}
\definecolor{groupblue}{RGB}{51,102,254}
\definecolor{linkred}{RGB}{165,0,33}
\renewcommand\sfdefault{phv}
\renewcommand\mddefault{mc}
\renewcommand\bfdefault{bc}
\setganttlinklabel{s-s}{START-TO-START}
\setganttlinklabel{f-s}{FINISH-TO-START}
\setganttlinklabel{f-f}{FINISH-TO-FINISH}
\sffamily
\begin{ganttchart}[
canvas/.append style={fill=none, draw=black!5, line width=.75pt},
hgrid style/.style={draw=black!5, line width=.75pt},
vgrid={*1{draw=black!5, line width=.75pt}},
today=7,
today rule/.style={
draw=black!64,
dash pattern=on 3.5pt off 4.5pt,
line width=1.5pt
},
today label font=\small\bfseries,
title/.style={draw=none, fill=none},
title label font=\bfseries\footnotesize,
title label node/.append style={below=7pt},
include title in canvas=false,
bar label font=\mdseries\small\color{black!70},
bar label node/.append style={left=2cm},
bar/.append style={draw=none, fill=black!63},
bar incomplete/.append style={fill=barblue},
bar progress label font=\mdseries\footnotesize\color{black!70},
group incomplete/.append style={fill=groupblue},
group left shift=0,
group right shift=0,
group height=.5,
group peaks tip position=0,
group label node/.append style={left=.6cm},
group progress label font=\bfseries\small,
link/.style={-latex, line width=1.5pt, linkred},
link label font=\scriptsize\bfseries,
link label node/.append style={below left=-2pt and 0pt}
]{1}{13}
\gantttitle[
title label node/.append style={below left=7pt and -3pt}
]{WEEKS:\quad1}{1}
\gantttitlelist{2,...,13}{1} \\
\ganttgroup[progress=57]{WBS 1 Summary Element 1}{1}{10} \\
\ganttbar[
progress=75,
name=WBS1A
]{\textbf{WBS 1.1} Activity A}{1}{8} \\
\ganttbar[
progress=67,
name=WBS1B
]{\textbf{WBS 1.2} Activity B}{1}{3} \\
\ganttbar[
progress=50,
name=WBS1C
]{\textbf{WBS 1.3} Activity C}{4}{10} \\
\ganttbar[
progress=0,
name=WBS1D
]{\textbf{WBS 1.4} Activity D}{4}{10} \\[grid]
\ganttgroup[progress=0]{WBS 2 Summary Element 2}{4}{10} \\
\ganttbar[progress=0]{\textbf{WBS 2.1} Activity E}{4}{5} \\
\ganttbar[progress=0]{\textbf{WBS 2.2} Activity F}{6}{8} \\
\ganttbar[progress=0]{\textbf{WBS 2.3} Activity G}{9}{10}
\ganttlink[link type=s-s]{WBS1A}{WBS1B}
\ganttlink[link type=f-s]{WBS1B}{WBS1C}
\ganttlink[
link type=f-f,
link label node/.append style=left
]{WBS1C}{WBS1D}
\end{ganttchart}
%
% A simpler example from the package documentation:
%
\begin{ganttchart}{1}{12}
\gantttitle{2011}{12} \\
\gantttitlelist{1,...,12}{1} \\
\ganttgroup{Group 1}{1}{7} \\
\ganttbar{Task 1}{1}{2} \\
\ganttlinkedbar{Task 2}{3}{7} \ganttnewline
\ganttmilestone{Milestone}{7} \ganttnewline
\ganttbar{Final Task}{8}{12}
\ganttlink{elem2}{elem3}
\ganttlink{elem3}{elem4}
\end{ganttchart}
\end{document}