甘特图问题(pgfgantt)

甘特图问题(pgfgantt)

我希望将甘特图拉长到右侧边距允许的宽度。是否有可以进行编辑的操作,无论我使用多少元素都可以实现此目的?

\documentclass[a4paper,12pt,default,numbered,print,index]{article}
\usepackage{lipsum}
\usepackage{enumitem}
\usepackage{graphicx} % Required for the inclusion of images
\usepackage{setspace}        % for use of \singlespacing and \doublespacing
\usepackage{comment}
\usepackage{pdfpages}
\usepackage{mathtools} % for 'bmatrix' env.
\usepackage{geometry}  % set page parameters suitably
\usepackage{array} % for '\extrarowheight' macro
\renewcommand\arraystretch{1.33}
\usepackage{siunitx}
\usepackage{color}
\usepackage{lscape}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{array}
\usepackage{booktabs} % For professional looking tables
\usepackage{multirow}
\usepackage{pgfgantt}

\begin{document}

\newganttchartelement*{mymilestone}{
mymilestone/.style={
shape=isosceles triangle,
inner sep=0pt,
draw=cyan,
top color=white,
bottom color=cyan!50
},
mymilestone incomplete/.style={
/pgfgantt/mymilestone,
draw=yellow,
bottom color=yellow!50
},
mymilestone label font=\slshape,
mymilestone left shift=0pt,
mymilestone right shift=0pt
}

\newgantttimeslotformat{stardate}{%
\def\decomposestardate##1.##2\relax{%
\def\stardateyear{##1}\def\stardateday{##2}%
}%
\decomposestardate#1\relax%
\pgfcalendardatetojulian{\stardateyear-10-01}{#2}%
\advance#2 by-1\relax%
\advance#2 by\stardateday\relax%
}

\hspace*{-2.5cm}
\begin{ganttchart}[vgrid, hgrid]{1}{17}
\gantttitle{September 2017}{4}
\gantttitle{October 2017}{4}
\gantttitle{November 2017}{5}
\gantttitle{December 2017}{4}\\
\gantttitlelist{1,...,17}{1}\\
\ganttgroup{\footnotesize Year 1}{1}{12} \\
\end{ganttchart}

\end{document}

在此处输入图片描述

答案1

x unit在你的情况下,你可以按如下方式缩放时间段的宽度:

\documentclass[a4paper,12pt]{article}
\usepackage{pgfgantt}

\begin{document}

\hspace*{-2.5cm}
\begin{ganttchart}[vgrid, hgrid, x unit=.9cm]{1}{17}
\gantttitle{September 2017}{4}
\gantttitle{October 2017}{4}
\gantttitle{November 2017}{5}
\gantttitle{December 2017}{4}\\
\gantttitlelist{1,...,17}{1}\\
\ganttgroup{\footnotesize Year 1}{1}{12} \\
\end{ganttchart}

\end{document}

在此处输入图片描述

相关内容