2

I am trying to use the \ganttvrule macro from pgfgantt as suggested by Torbjørn T. in response to Vertical lines in pgfgantt, but with no success. This is his MWE:

\documentclass[border=5mm]{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
  vgrid,
  hgrid,
  vrule/.style={very thick, blue},
  vrule label font=\bfseries
]{1}{8}
\gantttitle{2018}{8} \\
\ganttbar{}{1}{2} \\
\ganttbar{}{4}{8}

\ganttvrule{day x}{2}

\ganttvrule[
  vrule/.append style={red, thin},
  vrule offset=.2,
  vrule label node/.append style={anchor=north west}
  ]{day z}{6}
\end{ganttchart}

\end{document}

This should produce the following: enter image description here

But I get:

enter image description here

I have also tried to incorporate \ganttvrule in my own code, but with similar results.

I am using Overleaf which complains that this is an "undefined control sequence". (Overleaf also complains about the key \bfseries.)

If there are no coding errors the only thing that comes to mind is that Overleaf is not using the latest version of pgfgantt. I have not tried the code in any other editor.

  • Welcome to TeX.SE! This is just to tell you that on my updated TeXLive distribution I do get vertical lines, i.e. I do reproduce the upper of your screen shots. You may want to contact the overleaf service desk instead of asking here. – user121799 Jan 18 at 0:27
  • @marmot After getting the correct answer I see that this question is more editor specific, and I agree with your point. – Magnus G Jan 18 at 9:21
1

(Full disclosure: I'm on support staff at Overleaf.) Overleaf's TeX Live installations have not yet been upgraded to include the latest version of pgfgantt which includes the \ganttvrule macro.

As a workaround, for a self-contained package like pgfgantt, it suffices to download the latest version of pgfgantt.sty from the TeX Live sources here: pgfgantt and upload it to your Overleaf project.

This will allow you to use \ganttvrule in the meantime until Overleaf's TeX Live installation has been updated.

Here is your example code on Overleaf with pgfgantt.sty added to the project files: https://www.overleaf.com/read/czrnszbknvnk

And for completeness, the code and output:

\documentclass[border=5mm]{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
  vgrid,
  hgrid,
  vrule/.style={very thick, blue},
  vrule label font=\bfseries
]{1}{8}
\gantttitle{2018}{8} \\
\ganttbar{}{1}{2} \\
\ganttbar{}{4}{8}

\ganttvrule{day x}{2}

\ganttvrule[
  vrule/.append style={red, thin},
  vrule offset=.2,
  vrule label node/.append style={anchor=north west}
  ]{day z}{6}
\end{ganttchart}

\end{document}

enter image description here

  • In case the same error occurs in your local installation, e.g., because the installed package on the system is outdated, a quick fix is to download the linked pgfgantt.sty into the same folder of the working .tex file. – iled Feb 10 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.