0

This is my code, I want to write next to the numbers a t for time, under M1 and M2 but I did not find any possible solution for that except ganttbar, but that doesn't look good and is not what I want.

  \documentclass[a4paper, 12pt,fleqn]{article} 
   \usepackage{pgfgantt}
 \begin{document}
 \begin{figure}
 \centering
 {\sffamily
  \begin{ganttchart}[%
  inline, 
   y unit title=1.1cm,
  canvas/.style={draw=none},
 title/.style={draw=none},
 bar inline label anchor=west,
  bar inline label node/.append style={anchor=west, text=white},
  bar/.append style={fill=cyan!90!black,}, 
   bar height=.8,]{0}{18}
 \ganttbar[inline=false]{M1}{0}{3}
 \ganttbar{J1}{0}{3}
 \ganttbar{J2}{3}{4}
 \ganttbar{}{5}{18}\\
  \ganttbar[inline=false]{M2}{0}{5}
  \ganttbar{J2}{5}{8}
  \ganttbar{J1}{8}{12}
   \ganttbar{}{12}{18}\\
   \gantttitlelist{0,...,18}{1}
   \end{ganttchart}
   }
   \caption{To demonstrate Flow shop Scheduling}
   \end{figure}
  \end{document}
CarLaTeX
  • 62,716
Milo Li
  • 347

1 Answers1

1

You are using a gantt title list to generate those numbers on the bottom. In my (limited) knowledge, I don't think you can put something next to a title (or title list) in the same way you do with your ganttbars.

If the ganttbar look did not suite you, I suggest using another title and placing it below the list of numbers you created. Here is my example (code at end of post):

enter image description here

I added another \gantttitle after your title list. Do note that I used the option [y unit title=1cm], you can fiddle around with the placement as much as you like, or even add some boxes or grids to the pgfgantt. I think having the time beneath the numbers is a better approach due to the nature of gantt charts having their time structure in the title (as an example, here's a recent answer containing the basic look of gantt charts I usually make).

If that doesn't look good to you or suits your needs, then I think you'd have to add nodes with a tikzpicture from the [tikz][3] package, but I am not experienced in combining gantt charts and tikz so I cannot help you further.

Code used for example:

\documentclass[a4paper, 12pt,fleqn]{article}

\usepackage{pgfgantt}

\begin{document}
\begin{figure}
    \centering
    {\sffamily
    \begin{ganttchart}[%
        inline, 
        y unit title=1.2cm,
        canvas/.style={draw=none},
        title/.style={draw=none},
        bar inline label anchor=west,
        bar inline label node/.append style={anchor=west, text=white},
        bar/.append style={fill=cyan!90!black,},
        bar height=.8,]{0}{18},
        hgrid={thick, draw}
        ]

        \ganttbar[inline=false]{M1}{0}{3}
        \ganttbar{J1}{0}{3}
        \ganttbar{J2}{3}{4}
        \ganttbar{}{5}{18}\\

        \ganttbar[inline=false]{M2}{0}{5}
        \ganttbar{J2}{5}{8}
        \ganttbar{J1}{8}{12}
        \ganttbar{}{12}{18}\\

        \gantttitlelist{0,...,18}{1}\\

        \gantttitle[y unit title=1cm]{time}{18}
   \end{ganttchart}
   }
   \caption{To demonstrate Flow shop Scheduling}
  \end{figure}
\end{document}
  • hey @jiyuusensei , thank you for that solution! is there any other solution to put the numbers more left.... the 5 must be under the dash normally.. – Milo Li Dec 22 '16 at 16:29