3

I have a label for a ganttbar that is longer than the bar itself, and need to move it outside the bar to its right. Sketch of desired output:

----
|  |  My label here
----  

I tried to use the (sparse!) suggestion given in the manual (p.25) and wrote something like:

\ganttbar[inline label node/.append style={right=5mm}]{0.1,0.2}{2}{2}

but the result is actually the opposite of what I need. I get something like:

              ----
My label here |  |
              ----

Moreover, no matter how I play with the parameter of the style option (e..g right, left, different mm values, etc), I always get the same result, with the label on the left. I am obviously missing something important about the syntax of the ganttbar options.

Here is a MWE showing the wrong behavior:

\documentclass[a4paper,10pt]{article}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart} {1}{10}
   \ganttbar{Deliverable}{2}{2}
   \ganttbar[inline label node/.append style={right=5mm}]{0.1,0.2}{2}{2}
\end{ganttchart}
\end{document}
3
2

Thanks to @Jesse, the problem is solved! By comparing my MWE with the answer he linked to I found out what was wrong. In addition to the missing "bar" in the \ganttbar options, I was actually missing the "inline" option in the \ganttchart original declaration. Here is a corrected version of the MWE I originally gave:

\documentclass[a4paper,10pt]{article}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[inline]{1}{10}
   \ganttbar[inline=false]{Deliverable}{2}{2}
   \ganttbar[bar inline label node/.style={right=2mm}]{0.1,0.2}{2}{2}
\end{ganttchart}
\end{document}

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.