甘特图最近开始以错误的方式编译

甘特图最近开始以错误的方式编译

我的一个文档中有以下甘特图(由 pgfgantt 包生成):

\begin{ganttchart}[
    inline, 
    hgrid style/.style={draw=black!5, line width=.75pt},
    vgrid={*1{draw=black!5, line width=.75pt}},
    title top shift = .4,
    group label font = \tiny,
    group left shift = .1,
    group right shift = -.1,
    bar label font = \tiny,
    milestone label font = \tiny,
    bar label inline anchor/.style={above=0.1cm},
    milestone label inline anchor/.style={above=0.1cm}
  ]{24}{24}
  \gantttitle{Month}{24}\\
  \gantttitlelist{1,...,24}{1}\\
  \ganttbar[inline=false,bar/.style={draw=none, fill=none},bar label font = \normalfont]{Work packages}{1}{1}
  \ganttgroup{Familiarising}{1}{6}
  \ganttgroup{Core}{6}{12}
  \ganttgroup{Application}{13}{24}\\
  %DELIVERABLES
  \ganttbar[inline=false,bar/.style={draw=none, fill=none},bar label font = \normalfont]{Deliverables}{1}{1}
  \ganttbar[bar/.style={draw=none, fill=blue}]{1.1}{3}{3}
  \ganttbar[bar/.style={draw=none, fill=blue}]{1.2}{6}{6}
  \ganttbar[bar/.style={draw=none, fill=blue}]{2.1,2.2,2.3}{12}{12}
  \ganttbar[bar/.style={draw=none, fill=blue}]{3.2,3.4}{18}{18}
  \ganttbar[bar/.style={draw=none, fill=blue}]{3.1,3.3}{24}{24}\\
  %MILESTONES
  \ganttbar[inline=false,bar/.style={draw=none, fill=none},bar label font = \normalfont]{Milestones}{1}{1}
  \ganttmilestone{6m}{6}
  \ganttmilestone{12m}{12}
  \ganttmilestone{18m}{18}
  \ganttmilestone{24m}{24}\\
  %SEMINARS
  \ganttbar[inline=false,bar/.style={draw=none, fill=none},bar label font = \normalfont]{Seminars}{1}{1}
  \ganttbar[bar/.style={draw=none, fill=orange}]{}{3}{3}
  \ganttbar[bar/.style={draw=none, fill=orange}]{}{9}{9}
  \ganttbar[bar/.style={draw=none, fill=orange}]{}{15}{15}
  \ganttbar[bar/.style={draw=none, fill=orange}]{}{21}{21}\\
  %CONFERENCES
  \ganttbar[inline=false,bar/.style={draw=none, fill=none},bar label font = \normalfont]{Conferences}{1}{1}
  \ganttbar[bar/.style={draw=none, fill=red}]{}{6}{6}
  \ganttbar[bar/.style={draw=none, fill=red}]{}{12}{12}
  \ganttbar[bar/.style={draw=none, fill=red}]{}{18}{18}
  \ganttbar[bar/.style={draw=none, fill=red}]{}{24}{24}
\end{ganttchart}

当我两年前编写它时,它曾经运行得很好,但是现在(可能是在一些系统更新之后 - 我使用的是 Debian 稳定版)它呈现得完全错误:

错误的甘特图

我希望获取相应月份编号下的所有元素。我该如何修复?

答案1

也许您犯了打字错误,但我所做的更改只是]{24}{24}]{1}{24}发布的代码的第 13 行。我认为这会生成您想要的甘特图。

\documentclass[tikz,border=5pt,crop=true]{standalone}
\usepackage{pgfgantt}
\pagestyle{empty}
\begin{document}
    \begin{ganttchart}[
        inline, 
        hgrid style/.style={draw=black!5, line width=.75pt},
        vgrid={*1{draw=black!5, line width=.75pt}},
        title top shift = .4,
        group label font = \tiny,
        group left shift = .1,
        group right shift = -.1,
        bar label font = \tiny,
        milestone label font = \tiny,
        bar label inline anchor/.style={above=0.1cm},
        milestone label inline anchor/.style={above=0.1cm}
      ]{1}{24}
      \gantttitle{Month}{24}\\
      \gantttitlelist{1,...,24}{1}\\
      \ganttbar[inline=false,bar/.style={draw=none, fill=none},bar label font = \normalfont]{Work packages}{1}{1}
      \ganttgroup{Familiarising}{1}{6}
      \ganttgroup{Core}{6}{12}
      \ganttgroup{Application}{13}{24}\\
      %DELIVERABLES
      \ganttbar[inline=false,bar/.style={draw=none, fill=none},bar label font = \normalfont]{Deliverables}{1}{1}
      \ganttbar[bar/.style={draw=none, fill=blue}]{1.1}{3}{3}
      \ganttbar[bar/.style={draw=none, fill=blue}]{1.2}{6}{6}
      \ganttbar[bar/.style={draw=none, fill=blue}]{2.1,2.2,2.3}{12}{12}
      \ganttbar[bar/.style={draw=none, fill=blue}]{3.2,3.4}{18}{18}
      \ganttbar[bar/.style={draw=none, fill=blue}]{3.1,3.3}{24}{24}\\
      %MILESTONES
      \ganttbar[inline=false,bar/.style={draw=none, fill=none},bar label font = \normalfont]{Milestones}{1}{1}
      \ganttmilestone{6m}{6}
      \ganttmilestone{12m}{12}
      \ganttmilestone{18m}{18}
      \ganttmilestone{24m}{24}\\
      %SEMINARS
      \ganttbar[inline=false,bar/.style={draw=none, fill=none},bar label font = \normalfont]{Seminars}{1}{1}
      \ganttbar[bar/.style={draw=none, fill=orange}]{}{3}{3}
      \ganttbar[bar/.style={draw=none, fill=orange}]{}{9}{9}
      \ganttbar[bar/.style={draw=none, fill=orange}]{}{15}{15}
      \ganttbar[bar/.style={draw=none, fill=orange}]{}{21}{21}\\
      %CONFERENCES
      \ganttbar[inline=false,bar/.style={draw=none, fill=none},bar label font = \normalfont]{Conferences}{1}{1}
      \ganttbar[bar/.style={draw=none, fill=red}]{}{6}{6}
      \ganttbar[bar/.style={draw=none, fill=red}]{}{12}{12}
      \ganttbar[bar/.style={draw=none, fill=red}]{}{18}{18}
      \ganttbar[bar/.style={draw=none, fill=red}]{}{24}{24}
    \end{ganttchart}
\end{document}

在此处输入图片描述

相关内容