我正在使用 pgfgantt 来制作时序图。效果很好,只是时间标签的中心点太靠右 0.5 个时间单位了。示例
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
expand chart=\textwidth,
vgrid=true, hgrid=true,
canvas/.style={draw=none},
include title in canvas=false,
y unit title=0.5cm,
y unit chart=0.6cm,
title/.style={draw=none, fill=none},
title label font=\footnotesize
]{0}{14}
\gantttitlelist{0,...,14}{1}\\
\ganttbar{$\tau_1$}{0}{0}
\ganttbar[inline]{}{3}{3} \ganttbar[inline]{}{6}{6}
\ganttbar[inline]{}{9}{9} \ganttbar[inline]{}{12}{12}
\end{ganttchart}
\end{document}
标签 0、..、14 应位于虚线上方。
答案1
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
expand chart=\textwidth,
vgrid=true, hgrid=true,
canvas/.style={draw=none},
include title in canvas=false,
y unit title=0.5cm,
y unit chart=0.6cm,
title/.style={draw=none, fill=none},
title label font=\footnotesize,
title left shift=-1,
]{0}{14}
\gantttitlelist{0,...,14}{1}\\
\ganttbar{$\tau_1$}{0}{0}
\ganttbar[inline]{}{3}{3} \ganttbar[inline]{}{6}{6}
\ganttbar[inline]{}{9}{9} \ganttbar[inline]{}{12}{12}
\end{ganttchart}
\end{document}