我有下面的代码,可以生成如附图所示的标题。
如您所见,月份名称被挤压了,请问我该如何修复它?
谢谢。
\noindent\resizebox{\textwidth}{!}{
\begin{tikzpicture}[x=1cm, y=1cm]
\begin{ganttchart}[
hgrid,
vgrid,
time slot format=isodate-yearmonth,
title/.append style={shape=rectangle, fill=black!10},
bar/.append style={shape=rectangle, fill=black!20},
compress calendar
]{2016-06}{2018-09}
\gantttitlecalendar{year, month, month=shortname} \\
\ganttbar{Task1}{2016-06}{2018-07} \\
\end{ganttchart}
\end{tikzpicture}
}
答案1
例如,您可以将x unit
图表的默认设置稍微增加一点0.5cm
,或者使用减小标题的字体大小title font style=\tiny
。另请注意,您不需要将ganttchart
环境放在中tikzpicture
。
\documentclass[tikz]{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
x unit=0.7cm,
hgrid,
vgrid,
time slot format=isodate-yearmonth,
title/.append style={shape=rectangle, fill=black!10},
bar/.append style={shape=rectangle, fill=black!20},
compress calendar
]{2016-06}{2018-09}
\gantttitlecalendar{year, month, month=shortname} \\
\ganttbar{Task1}{2016-06}{2018-07} \\
\end{ganttchart}
\begin{ganttchart}[
hgrid,
vgrid,
time slot format=isodate-yearmonth,
title/.append style={shape=rectangle, fill=black!10},
title label font={\tiny},
bar/.append style={shape=rectangle, fill=black!20},
compress calendar
]{2016-06}{2018-09}
\gantttitlecalendar{year, month, month=shortname} \\
\ganttbar{Task1}{2016-06}{2018-07} \\
\end{ganttchart}
\end{document}