我按照制作甘特图的详细说明进行操作(如何创建甘特图?),我做得很好。不过,我注意到,如果我尝试使用西班牙语作为语言(包括 \usepackage[spanish]{babel}),它将无法编译。有什么想法可以解决吗?我假设 babel 包造成了一些问题,如果我想要“septiembre”而不是“September”,我该怎么办?
这是我的源代码:
\documentclass{standalone}
\usepackage[spanish]{babel}
\usepackage{color}
\usepackage{tikz}
\usepackage{pgfgantt}
%Used to draw gantt charts, which I will use for the calendar.
%Let's define some awesome new ganttchart elements:
\newganttchartelement{orangebar}{
orangebar/.style={
inner sep=0pt,
draw=red!66!black,
very thick,
top color=white,
bottom color=orange!80
},
orangebar label font=\slshape,
orangebar left shift=.1,
orangebar right shift=-.1
}
\newganttchartelement{bluebar}{
bluebar/.style={
inner sep=0pt,
draw=purple!44!black,
very thick,
top color=white,
bottom color=blue!80
},
bluebar label font=\slshape,
bluebar left shift=.1,
bluebar right shift=-.1
}
\newganttchartelement{greenbar}{
greenbar/.style={
inner sep=0pt,
draw=green!50!black,
very thick,
top color=white,
bottom color=green!80
},
greenbar label font=\slshape,
greenbar left shift=.1,
greenbar right shift=-.1
}
\begin{document}
\begin{ganttchart}[
hgrid style/.style={black, dotted},
vgrid={*5{black,dotted}, *1{white, dotted}, *1{black, dashed}},
x unit=3mm,
y unit chart=9mm,
y unit title=12mm,
time slot format=isodate,
group label font=\bfseries \Large,
link/.style={->, thick}
]{2020-09-22}{2020-12-21}
\gantttitlecalendar{year, month=name, week}\\
\ganttgroup[
group/.append style={fill=orange}
]{IMKL Reader}{2020-09-22}{2020-11-9}\\ [grid]
\ganttorangebar[
name=Documentation
]{Documentation}{2020-09-23}{2020-09-23}\\ [grid]
\ganttorangebar[
name=FMETutorial
]{FME Tutorial}{2020-09-24}{2020-09-26}\\ [grid]
\ganttorangebar[
name=FME
]{FME}{2020-09-30}{2020-10-03}
\ganttlinkedorangebar{}{2020-10-7}{2020-10-10}
\ganttlinkedorangebar{}{2020-10-14}{2020-10-15}
\ganttlinkedorangebar{}{2020-10-17}{2020-10-17}
\ganttlinkedorangebar[name=FMEend]{}{2020-10-21}{2020-10-24}
\ganttlinkedorangebar{}{2020-10-28}{2020-10-31}\\ [grid]
\ganttorangebar[name=Manual]{Manual}{2020-10-30}{2020-10-31}
\ganttlinkedorangebar{}{2020-11-4}{2020-11-7} \ganttnewline[thick, black]
\ganttgroup[
group/.append style={fill=blue}
]{Test Cases}{2020-10-27}{2020-11-9}
\ganttgroup[
group/.append style={fill=blue}
]{}{2020-11-17}{2020-12-19}\\ [grid]
\ganttbluebar{Innocent testing}{2020-10-30}{2020-10-31}
\ganttlinkedbluebar[name=Innocent]{}{2020-11-4}{2020-11-7}
\ganttlinkedbluebar{}{2020-12-4}{2020-12-5}
\ganttlinkedbluebar{}{2020-12-9}{2020-12-10}\\ [grid]
\ganttbluebar{Test Case Testing}{2020-11-6}{2020-11-7}
\ganttlinkedbluebar{}{2020-11-18}{2020-11-19}
\ganttlinkedbluebar{}{2020-11-24}{2020-11-27}
\ganttlinkedbluebar{}{2020-12-1}{2020-12-4}
\ganttlinkedbluebar{}{2020-12-10}{2020-12-10}
\ganttlinkedbluebar{}{2020-12-16}{2020-12-16}\\ [grid]
\ganttbluebar[name=Writing]{Writing}{2020-11-18}{2020-11-19}
\ganttlinkedbluebar{}{2020-11-24}{2020-11-28}
\ganttlinkedbluebar{}{2020-12-4}{2020-12-4}
\ganttlinkedbluebar{}{2020-12-10}{2020-12-10}
\ganttlinkedbluebar{}{2020-12-16}{2020-12-16}\ganttnewline[thick, black]
\ganttgroup[
group/.append style={fill=green}
]{KLIP Manager}{2020-11-3}{2020-11-9}
\ganttgroup[
group/.append style={fill=green}
]{}{2020-11-17}{2020-11-23}\\ [grid]
\ganttgreenbar{Manual}{2020-11-4}{2020-11-7}
\ganttlinkedgreenbar{}{2020-11-18}{2020-11-19}
%Implementing links
\ganttlink[link mid=0.75]{Documentation}{FME}
\ganttlink{FMETutorial}{FME}
\end{ganttchart}
\end{document}
答案1
pgfgantt
基于pgfcalendar
包。
关于本地化问题pgfmanual
:
所有星期几或月份的文本表示(如“星期一”或“二月”)都用
\translate
来自包的命令包装translator
(如果未加载此包,则不会进行任何翻译)。此外,如果已加载包,pgfcalendar
包将尝试加载。translator-months-dictionary
translator
更换
\usepackage[spanish]{babel}
和
\usepackage[spanish]{babel}
\usepackage[spanish]{translator}
在您的文件中应该可以做到这一点。