1

How do I remove the box around the tasks in the gantt chart shown in the following code. How can I then make the bar and group descriptions nice and snug with the tasks?

\NeedsTeXFormat{LaTeX2e}
\documentclass[12pt]{standalone}
\usepackage{pgfgantt}
\usepackage{times}

\definecolor{teal}{rgb}{0,0.57,0.81}%
\definecolor{aqua}{rgb}{0.51,0.81,0.79}%
\definecolor{blue_gray}{rgb}{0.36,0.52,0.63}%

% create a new command for a ganttbar entry
\newcommand{\ganttbarentryprogresscustom}[5]{%
\ganttbar[progress=#1,%
bar/.append style={pattern color = #2},%
bar progress label anchor=south,%
bar inline label node/.style={above=3pt}]%
{#3}{#4}{#5}%
}%

\begin{document}
\begin{ganttchart}[%
x unit=1.4cm,%
y unit chart=1.1cm,%
time slot unit=day,%
bar/.append style={pattern=north west lines, pattern color = cyan},%
inline%
]{0}{11}%
\ganttgroup[inline=false]{Task 1}{1}{10}\\%
\ganttbarentryprogresscustom{100}{blue_gray}{Subtask 1}{1}{6}
\ganttbarentryprogresscustom{90}{teal}{Subtask 2}{7}{8}%
\ganttbarentryprogresscustom{75}{aqua}{Subtask 3}{9}{10}%
\end{ganttchart}%
\end{document}%
5
  • bar/.append style={draw=none,pattern color = #2},? Added draw=none. Don't think I quite understand the second part. May 4, 2019 at 20:28
  • I think what you're proposing adjusts the box around an individual task bar, rather than the box around the Gantt chart.
    – John Chris
    May 4, 2019 at 20:40
  • 1
    Sorry, I clearly misunderstood. canvas/.append style={draw=none} then. May 4, 2019 at 20:44
  • canvas/.append style={draw=none} as an option to the ganttchart works. Thanks! Re-reading my wording, there is some ambiguity.
    – John Chris
    May 4, 2019 at 20:48
  • The second part of the question refers to the horizontal spacing between the right-justified group name (Task 1 in this example), and the left edge of the canvas. I'd like to reduce this space.
    – John Chris
    May 4, 2019 at 20:55

1 Answer 1

2

The frame around the entire diagram is drawn by the canvas node, and to remove it you add

canvas/.append style={draw=none}

to the ganttchart environment options.

For the second part, the reason there is so much space between the task 1 label and task bar itself, is that the diagram spans the region 0 to 11, while your task spans 1 to 10. Hence, there is one unit of empty space on the left side. If you add group label node/.append style={draw}, and you don't remove the canvas frame, you'll see that there is no space between that node and the canvas node.

There is a little bit of space between the text and the node border, which you can remove with group label node/.append style={inner sep=0}. But I'm wondering whether you actually want \begin{ganttchart}[...]{1}{11} instead of \begin{ganttchart}[...]{0}{11}.

2
  • 1
    By the way, I think the times package is considered outdated, and that newtxtext (and possibly newtxmath if you want math) is recommended instead. May 5, 2019 at 10:45
  • All great and relevant comments; solution works. Thanks.
    – John Chris
    May 5, 2019 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .