
분할된 직사각형의 각 부분의 중심을 기준으로 라벨을 정확하게 배치할 수 있는 방법이 있습니까? 다음 예에서는 두 가지 오류를 보여줍니다.
- 정렬은 하위 부품의 왼쪽에 있습니다.
- 세로 정렬이 잘못된 것 같습니다.
다음은 최소한의 작업 예입니다.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.multipart}
\begin{document}
\begin{tikzpicture}[
date/.style= {
rectangle split,
rectangle split horizontal,
rectangle split parts=3,
draw
}]
\node[date] (today) {
\nodepart{one} {\texttt{2014}}
\nodepart{two} {\texttt{01}}
\nodepart{three} {\texttt{01}}
};
\node[below=2mm of today.one] {\texttt{y}};
\node[below=2mm of today.two] {\texttt{m}};
\node[below=2mm of today.three] {\texttt{d}};
\end{tikzpicture}
\end{document}
답변1
수평 정렬을 수정하려면 등을 기준으로 배치합니다 today.one south
. 수직 정렬을 수정하려면 노드의 앵커를 base
텍스트의 기준선인 으로 설정합니다.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.multipart}
\begin{document}
\begin{tikzpicture}[
date/.style= {
rectangle split,
rectangle split horizontal,
rectangle split parts=3,
draw
}]
\node[date] (today) {
\nodepart{one} {\texttt{2014}}
\nodepart{two} {\texttt{01}}
\nodepart{three} {\texttt{01}}
};
\node[below=3mm of today.one south,anchor=base] {\texttt{y}};
\node[below=3mm of today.two south,anchor=base] {\texttt{m}};
\node[below=3mm of today.three south,anchor=base] {\texttt{d}};
\end{tikzpicture}
\end{document}