倒角矩形和最小文字高度

倒角矩形和最小文字高度

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}

相關內容