[Solved] How newif command works

Hunsu Asks: How newif command works
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:

Code:
newcommanddrawverticalline[1]{%
begingroup%
begin{pgfinterruptboundingbox}%
begin{scope}
 newififgtt@includetitle
   ganttset{%
      include title in canvas/.is if=gtt@includetitle,%
      include title in canvas
      }
   gtt@tsstojulian{#1}{gtt@today@slot}
   gtt@juliantotimeslot{gtt@today@slot}{gtt@today@slot}%
   ifgtt@includetitle%
    defy@upper{0}%
   else%
     pgfmathsetmacroy@upper{%
      gtt@lasttitleline * ganttvalueof{y unit title}%
     }%
   fi%
  pgfmathsetmacroy@lower{%
  gtt@lasttitleline * ganttvalueof{y unit title}%
  + (gtt@currentline - gtt@lasttitleline - 1)%
  * ganttvalueof{y unit chart}%
  }%
  pgfmathsetmacrox@mid{%
     (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}};%
 end{scope}
 end{pgfinterruptboundingbox}%
  endgroup%
}

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

Code:
documentclass{article}
usepackage[frenchb]{babel}  
usepackage{pgfgantt}
usetikzlibrary{shadows}

begin{document}
begin{tikzpicture} % optional
   begin{ganttchart}[x unit=1.8mm, 
                  y unit chart=0.87cm, 
                  time slot format=isodate, 
                  vgrid=*{5}{dotted},
                 ]
                  {2014-04-14}{2014-07-11}
       gantttitlecalendar{month=name} \ 

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

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

       drawverticalline{2014-05-07}
   end{ganttchart}
end{tikzpicture}
end{document}

{
“lightbox_close”: “Close”,
“lightbox_next”: “Next”,
“lightbox_previous”: “Previous”,
“lightbox_error”: “The requested content cannot be loaded. Please try again later.”,
“lightbox_start_slideshow”: “Start slideshow”,
“lightbox_stop_slideshow”: “Stop slideshow”,
“lightbox_full_screen”: “Full screen”,
“lightbox_thumbnails”: “Thumbnails”,
“lightbox_download”: “Download”,
“lightbox_share”: “Share”,
“lightbox_zoom”: “Zoom”,
“lightbox_new_window”: “New window”,
“lightbox_toggle_sidebar”: “Toggle sidebar”
}

enter image description here

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

Code:
ifgtt@includetitle%
  defy@upper{0}%
else%
  pgfmathsetmacroy@upper{%
    gtt@lasttitleline * ganttvalueof{y unit title}%
  }%
fi%

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

Code:
newififgtt@includetitle
ganttset{%
    include title in canvas/.is if=gtt@includetitle,%
    include title in canvas
    }

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.