[Tex/LaTex] PGFGantt: change name of week

pgfgantttikz-pgf

Currently I am preparing a Gantt-Diagramm with pgfgantt. In Germany it is common to use the abbreviation KW (Kalendarwoche) which translates to calendar week. I would like to change week 1, 2, … to KW 1, 2, … in my Gantt-Diagramm.

What I have tried before:

  • find something like pgfcalendarweekname in the tikz manual to define a new name as I have done with the weekday and month names (wasn't able to find pdfcalendarweekname)
  • Use the translator package (didn't change week to Woche which would have been fine)
  • Use the polyglossia package (XeLatex messes up my given template)

edit: I tried to include the MWE as code but I wasn't able to using Firefox on a Mac

\documentclass[ngerman]{scrartcl}  
\usepackage{babel}  

\usepackage{pgfgantt}  

%German abbreviations  
\def\pgfcalendarweekdayletter#1{%  
 \ifcase#1M\or D\or M\or D\or F\or S\or S\fi%  
}  
%German abbreviations; Use S. instead of September  
\def\pgfcalendarmonthname#1{%  
 \ifcase#1 Dezember \or Januar\or Februar\or März\or April\or Mai\or Juni\or Juli \or August \or S. \or Oktober \or November \or Dezember\fi%  
}  

\begin{document}  

\begin{ganttchart}[  
hgrid,%  
vgrid,%  
time slot format=simple,%  
time slot format/start date =2015-09-28%  
]{1}{18}  
\gantttitlecalendar{year, month=name,week=40 day, weekday=letter} \\  
\ganttgroup{1. Gruppe}{1}{18} \\  
\ganttbar{1.1 Arbeitspaket}{1}{2}\\  
\ganttbar{1.2 Arbeitspaket}{3}{18}  
\ganttlink{elem1}{elem2}  
\end{ganttchart}  

\end{document}  

Best Answer

That text string is defined by pgfgantt, not pgf itself, and is adjustable via the calendar week text key. The default value is Week~\currentweek. You can add calendar week text={KW~\currentweek} to the options of individual ganttcharts, or use \ganttsett to set it globally.

\documentclass[ngerman]{scrartcl}  
\usepackage{babel}  

\usepackage{pgfgantt}  

%German abbreviations  
\def\pgfcalendarweekdayletter#1{%  
 \ifcase#1M\or D\or M\or D\or F\or S\or S\fi%  
}  
%German abbreviations; Use S. instead of September  
\def\pgfcalendarmonthname#1{%  
 \ifcase#1 Dezember \or Januar\or Februar\or März\or April\or Mai\or Juni\or Juli \or August \or S. \or Oktober \or November \or Dezember\fi%  
}  

% This line is added
\ganttset{calendar week text={KW~\currentweek}}

\begin{document}  

\begin{ganttchart}[  
hgrid,%  
vgrid,%  
time slot format=simple,%  
time slot format/start date =2015-09-28%
]{1}{18}  
\gantttitlecalendar{year, month=name,week=40 day, weekday=letter} \\  
\ganttgroup{1. Gruppe}{1}{18} \\  
\ganttbar{1.1 Arbeitspaket}{1}{2}\\  
\ganttbar{1.2 Arbeitspaket}{3}{18}  
\ganttlink{elem1}{elem2}  
\end{ganttchart}  

\end{document}