
似乎是透過自動考慮下降部分的空間來pgfgantt
垂直對齊標籤:inline
\documentclass{article}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
inline,
]{1}{4}
\ganttbar{XX}{2}{3}
\end{ganttchart}
\end{document}
pgfgantt
手冊中的例子也可以看到同樣的情況。如果沒有下降部分,如何強制它垂直居中標籤?我透過設定實現了這一點bar inline label node/.append style={text depth=.5ex}
,但我不想每次都手動設定一個神奇的數字。
答案1
若要刪除\strut
自動插入的條形標籤文本,請使用
\ganttset{bar label text=#1}
若要刪除\strut
相似區域中的每個自動插入的內容,請使用
\documentclass{article}
\usepackage{pgfgantt}
\usepackage{xpatch}
\ganttset{
title label text=#1,
bar label text=#1,
group label text=#1,
milestone label text=#1,
}
\makeatletter
\xpatchcmd\@newganttchartelement@definekeys
{\strut}
{}
{}{\fail}
\makeatother
\begin{document}
\begin{ganttchart}[inline]{1}{4}
\ganttbar{XX}{2}{3}
\end{ganttchart}
\end{document}