1

I would like to fit a gantt chart in a beamer frame with the babel package loaded with French language.

\documentclass[10pt,fleqn]{beamer}
\usepackage[french]{babel}
\usepackage{pgfgantt}
\begin{document}

\begin{frame} \frametitle{Gantt charts} \begin{ganttchart}[ x unit=0.22cm, y unit title=0.5cm, y unit chart=0.5cm, title label font=\fontsize{4}{5}\selectfont, bar label font=\tiny, group label font=\tiny\bfseries, milestone label font=\tiny\itshape, ]{1}{40} \gantttitle{2020}{4} \gantttitle{2021}{12} \gantttitle{2022}{12} \gantttitle{2023}{12} \ \gantttitlelist{1,...,40}{1} \ \ganttgroup{Groupe 1}{1}{7} \ \ganttbar{Tâche 1}{1}{2} \ \ganttlinkedbar{Tâche 2}{3}{7} \ganttnewline \ganttmilestone{Publication}{7} \ganttnewline \ \ganttbar{Tâche 3}{8}{12} \ganttlink{elem2}{elem3} \ganttlink{elem3}{elem4} \end{ganttchart} \end{frame}

\end{document}

\end{frame}

Babel is not working with pgfgantt in a beamer frame ?

sobat
  • 55
  • Hi, welcome to TeX.SE! Could you be so kind and clarify what you mean when you say it "is not working"? I just tried compiling your example, and I'm not seeing any obvious issues. – chsk Mar 27 '21 at 21:30
  • Hi ! it's strange... on my computer I have 2 compilations errors : "Package tikz error + or - expected "and" Package tikz error Giving up on this path. Did you forget a semicolon?" – sobat Mar 27 '21 at 21:39
  • Hmm, what does the log file say? Anything preceding those messages? Also, what TeX compiler are you using? – chsk Mar 28 '21 at 08:25
  • This is a duplicate of https://tex.stackexchange.com/questions/289852/package-tikz-error-with-pgfgantt with the answer in comments, pointing to https://tex.stackexchange.com/questions/86023/tikz-declare-function-and-babel-french-option/ so it is a bit difficult to close. Anyway, the solution is to put \usetikzlibrary{babel} directly below \usepackage{pgfgantt}. – Marijn Mar 28 '21 at 11:06
  • 1
    Or alternatively, if you don't want to use the tikzlibrary for some reason, you can put \shorthandoff{:;!} in your Gantt chart, just before the first \gantttitle. – Marijn Mar 28 '21 at 11:09
  • I have already try to use \usetikzlibrary{babel}, it works for an article document but not for a beamer... The other solution proposed (\shorthandoff{:;!}) works perfectly !! Thanks !! – sobat Mar 28 '21 at 18:48

0 Answers0