3

I'm trying to add a table-like structure left of a ganttchart. It appeared to me that labeling every bar with its own tabular of fixed column-width would be the easiest and I got quite close to what I want:

enter image description here

But I can't get rid of the vertical space at the bottom of the table (red circle) - what spacing command does define it?

Any hints are appreciated.


If it helps, here is the output of lua-visual-debug

enter image description here

Another discovery, as the gantt chart is actually a tikz picture, I can move it down by:

\tikzset{baseline}

in the preamble, but than I have space above. How to remove all the spacing aorund the tikzpciture?


(not so) MWE

\documentclass{scrreprt}

\usepackage[top=25mm, bottom=20mm, left=20mm, right=20mm, foot=20mm]{geometry}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{hyperref}


\usepackage{translator}  %// wird zur Übersetung von pgfgantt benötigt.
\usepackage{pgfgantt}

\ganttset{
%vgrid={*{1}{dotted}, draw = none },
vgrid = dotted,
hgrid = dotted,
%hgrid style/.style={thin},
newline shortcut=true,
%
y unit title = 15pt,
title height = 1,
y unit chart = 15pt,
x unit=0.014\textwidth,
%
canvas/.style={
    shape=rectangle, 
    draw=black,
    line width = 0.4pt,
    },
group peaks tip position=0,
group label node/.append style={align=right},
%
bar label node/.append style={align=right},
bar/.append style={fill=gray!20!white},
bar height=0.3,
bar top shift=0.3,
group top shift=0.5,
%
group peaks width=2,
}

\newcommand{\tabgantt}[1]{
\small
\begin{tabular}{p{0.1\textwidth}@{\hskip 0.015\textwidth}p{0.51\textwidth}}
#1
\end{tabular}
}

\newcommand{\tabganttgroup}[3]{
\ganttgroup{
\tabgantt{#1}}{#2}{#3}
}

\newcommand{\tabganttbar}[3]{
\ganttbar{
\tabgantt{#1}}{#2}{#3}
}

\begin{document}

\chapter{title}
\section{section}
\subsection{subsection}
\subsubsection*{subsubsection}\label{par:subsection}
\subparagraph{subparagraph}\label{par:subparagraph}

\begin{table}[h]
\setlength{\tabcolsep}{0pt}
\caption{my gantt chartt}
\label{tab:gantt}
\centering
\begin{tabular}{@{}|c@{}}

\specialrule{0.4pt}{0pt}{-0.4pt}
\specialrule{0.4pt}{30pt}{0pt}
\specialrule{0pt}{0pt}{-30.4pt}

\begin{ganttchart}{1}{24}

\gantttitle[]{2017}{12} \gantttitle[]{2018}{12}  \\
\gantttitle{I}{3}\gantttitle{II}{3}\gantttitle{III}{3}\gantttitle{IV}{3}
\gantttitle{I}{3}\gantttitle{II}{3}\gantttitle{III}{3}\gantttitle{IV}{3} \\

\tabganttgroup{ & \nameref{par:subsection} }{4}{15} \\
\tabganttbar{\ref{par:subsection} & \nameref{par:subparagraph} }{4}{15} \\
\tabganttbar{\ref{par:subsection} & \nameref{par:subparagraph} }{4}{15} \\
\tabganttbar{\ref{par:subsection} & \nameref{par:subparagraph} }{4}{15} \\
\tabganttgroup{ & \nameref{par:subsection} }{4}{15} \\
\tabganttbar{\ref{par:subsection} & \nameref{par:subparagraph} }{4}{15} \\
\tabganttbar{\ref{par:subsection} & \nameref{par:subparagraph} }{4}{15} \\
\tabganttbar{\ref{par:subsection} & \nameref{par:subparagraph} }{4}{15} 
\end{ganttchart}%
\\
\specialrule{0.4pt}{0pt}{-0.4pt}

\end{tabular}
\end{table}
\end{document}
  • Since you're using booktabs, I suppose the spacing is something like \aboverulesep etc., however, the usage of booktabs and vertical rules is ... well, not really suggested – user31729 Jun 6 '16 at 17:05
  • For a manual fix, change your final \\ to \\[-6.5pt] – Steven B. Segletes Jun 6 '16 at 17:31
  • @StevenB.Segletes I tried this, but it won't shorten the vertical line on the left. – thewaywewalk Jun 6 '16 at 20:17
  • @ChristianHupfer I'd prefer not use vertical lines, but I need a least the ones in the middle. But I'm not able to configure the title and the canvas of the ganttchart to show at least in between the two years. Apart from that: do you see a solution without booktabs? Apart from specialrule It probably could be avoided. – thewaywewalk Jun 6 '16 at 20:21

Your Answer

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

Browse other questions tagged or ask your own question.