
pgf/tikz: 높이가 고정된 육각형을 만들려고 합니다. 모따기된 직사각형을 사용합니다. 직사각형을 육각형으로 바꿀 수는 있는데 최소 높이 옵션을 적용하려고 하면 xsep 설정에 방해가 되는 것 같습니다.
이 문제를 해결하는 방법을 아는 사람이 있나요?
제가 만들려고 하는 매크로입니다.
\documentclass[a4paper, 12pt]{report}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shapes.symbols}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{positioning}
\usetikzlibrary{matrix}
\newcommand{\Task}[2]{|[chamfered rectangle, chamfered rectangle angle=50, thick, draw, text centered, text width=1.5cm, minimum width=3cm, minimum height=1.3cm, chamfered rectangle xsep=5cm, scale=0.5](#1)|{#2}}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\matrix (grlplay) [matrix of nodes, row sep = 0mm] %grlFlow-row-column
{
&\Task{label}{name} & \\
};
\end{tikzpicture}
\end{figure}
\end{document}
감사합니다.
답변1
최종 모양 형태로 원하는 것이 무엇인지 이해한다면 .보다 signal
모양 으로 얻는 것이 더 쉽습니다 chamfered rectangle
. 원하는 텍스트 높이와 관계없이 육각형을 제공합니다.
위 그림에서는 행렬을 확장하고 셀을 정의하는 방법을 변경했습니다.
\documentclass[a4paper, 12pt]{report}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix,shapes.symbols}
% for show only figure
\usepackage[active,floats,tightpage]{preview}
\setlength\PreviewBorder{1em}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}[
task/.style = {signal, draw, thick,
signal to=west and east,
text width=22mm, minimum height=9mm, align=center}
]
\matrix (grlplay) [matrix of nodes, row sep = 1mm] %grlFlow-row-column
{
left & \node[task] {name}; & right \\
left & \node[task] {name}; & right \\
};
%\draw[red,->] (grlplay-1-1) -- (grlplay-1-3);
\end{tikzpicture}
\end{figure}
\end{document}