As I haven't got answers to my questions here:

How to draw vertical lines using pgfgantt package, I decided to implement my own command that I added to the pgfgantt.sty file (I have made a copy). I looked at pgfgantt.sty and I came up with this code that works with only one problem:

      include title in canvas/.is if=gtt@includetitle,%
      include title in canvas
      \gtt@lasttitleline * \ganttvalueof{y unit title}%
  \gtt@lasttitleline * \ganttvalueof{y unit title}%
  + (\gtt@currentline - \gtt@lasttitleline - 1)%
  * \ganttvalueof{y unit chart}%
     (\gtt@today@slot - 1 + \ganttvalueof{today offset})%
                    * \ganttvalueof{x unit}%
  \draw [/pgfgantt/today rule]
                (\x@mid pt, \y@upper pt) -- (\x@mid pt, \y@lower pt)
                node [/pgfgantt/today label node] {\ganttvalueof{today   label}};%

This is just an example to show that it works. Here's what I get with this code :


\begin{tikzpicture} % optional
   \begin{ganttchart}[x unit=1.8mm, 
                  y unit chart=0.87cm, 
                  time slot format=isodate, 
       \gantttitlecalendar{month=name} \\ 

       \ganttbar[progress=100]{title1}{2014-04-14}{2014-04-15} \\

       \ganttbar[progress=100]{title2}{2014-04-15}{2014-04-17} \\


enter image description here

Normally the line should be draw below the title bar. It's this code that define where we start drawing :

    \gtt@lasttitleline * \ganttvalueof{y unit title}%

How \ifgtt@includetitle works? It's defined like this :

    include title in canvas/.is if=gtt@includetitle,%
    include title in canvas
  • 1
    Usually define the \newif\ifgtt@includetitle outside your command definition of \drawverticalline. Then also, where do you set this conditional (true would be \gtt@includetitletrue and false would be \gtt@includetitlefalse)? It's default is false.
    – Werner
    May 7, 2014 at 20:46
  • 1
    \gantset{% ...} is not part of the \newif declaration: \newif\ifgtt@includetitle creates the conditional, then, as in your earlier snippet, you have \ifgtt@include ...<true> ... \else ...<false> ... \fi. You then can pick 'true' or 'false' with \gtt@includetitletrue or \gtt@includetitlefalse. Basically, it means: if \gtt@include = true, do <true>; otherwise do <false>. Note that the default is false.
    – jon
    May 7, 2014 at 20:47
  • 1
    why have you put the command into a file called pgfgantt.sty so making your document incompatible with every other latex installation, rather than put it in the document or a package of a different name? No one can run your MWE (unless they want to break their own installation) May 7, 2014 at 20:58
  • You can copy the file into the folder conatining your tex file. rename the package to mypgfgantt.sty and use usepackage{mypgfgantt}. This will not break your installation. And I just added a command I haven't modified any code of the original
    – Hunsu
    May 7, 2014 at 21:02
  • 1
    At the very least you should rename the .sty file. Although David Carlisle's suggestions are both better and easier.
    – cfr
    May 8, 2014 at 2:19

1 Answer 1


\newif (in LaTeX) is defined by the following. (The original in plain has a slightly different definition).

  \count@\escapechar \escapechar\m@ne

So \newif takes a command name (which by convention always starts with if) and defines three commands

\newif\iffoo defines

\iffoo to be \iffalse and defines

\footrue to be a command that defines \iffoo to be \iftrue and defines

\foofalse to be a command that defines \iffoo to be \iffalse.

\iftrue and \iffalse are primitives that act as true and false respectively.

So if you have


  some code here


the code will be executed or not depending whether earlier you have executed \footrue to change the meaning of \iffoo to \iftrue.

  • Thanks for that. In my case its value is contained in the include title in canvas parameter that we pass to the environment like this include title in canvas=true. How to execute the right command depending of the value of include title in canvas?
    – Hunsu
    May 7, 2014 at 20:59
  • @user230137 sorry I don't understand the comment, but it appears to be a question about pgf key setting (about which I know little) rather than about \newif May 7, 2014 at 21:03
  • Ok thanks. With your answer I could perhaps find the solution. If I can't I will just set it to true and do my thing.
    – Hunsu
    May 7, 2014 at 21:06
  • What does the header here, \count@\escapechar \escapechar\m@ne mean? By looking up the definitions I only find \count255\escapechar\escapechar\count22, which doesn't help me understand at all. May 1, 2018 at 9:49
  • 1
    @Atcold as I commented in the commen above, you should ask new questions, as new qustion posts not as comments on old answers. how can you say if it is tex or latex? as I comment in the answer that definition is the one in latex but plain tex has a simliar \newif defintion. the commands used in the defintion, \iftrue, \let, \iffalse are tex primitives. Mar 14, 2022 at 23:19

You must log in to answer this question.

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