节点大小对齐 2

节点大小对齐 2

再次帮助:我无法使 TST 箭头与下面的 3 个块大小相同。

我希望 TST 箭头的大小与 Nov、Dev、Jan 这三个块的大小完全相同。

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}

\usepackage{tikz}
\usetikzlibrary{chains,scopes,positioning,backgrounds,shapes,fit,shadows,
calc}

\usepackage[paper=a3paper, landscape=true,margin={1cm,2cm},
headsep=5mm,headheight=2cm]{geometry}


\begin{document}
\noindent

\begin{tikzpicture}[background rectangle/.style={draw=blue!50,fill=blue!10,
      rounded corners=5pt, drop shadow},
    show background rectangle]
    \tikzset
    {
      arrow/.style=
      {
        draw,
        minimum height=10mm,
        minimum width=20mm,
        inner sep=0pt,
        shape=signal,
        signal from=west,
        signal to=east,
        signal pointer angle=110,
        top color=green!60!black!90!,
        bottom color=green!30,
        % fill=blue!50,
        drop shadow,
      },
      sign/.style={
      draw,
      minimum height=10mm,
      minimum width=20mm,
      inner sep=0pt,
      shape=signal,
      signal to=east,
      signal pointer angle=110,
      % fill=blue!50,
      top color=green!60!black!90!,
      bottom color=green!30,
      drop shadow,
    },
  }


  \begin{scope}[start chain=going right,node distance=1mm]
    \node[name=sept3, sign,on chain, minimum width=30mm, anchor=west] {Sept.};
    \foreach \mois / \Smois in
    {
      oct3/Oct., nov3/Nov., dec3/Déc.,
      jan3/jan., fev3/fév., mar3/Mars
    } \node[name=\mois, arrow, minimum width=30mm,on chain, font=\small] {\Smois};

    \draw let \p1=($(oct3.east)-(sept3.west)$), \n2={veclen(\x1,\y1)} in  
  node[sign, name=ideation, above=(0mm of sept3.north west),
  anchor=south west,
  font=\small, minimum width=\n2-\pgflinewidth, top color=brown!30!black!90,
  bottom color=brown!30,] {Idéation};

  \draw let \p1=($(oct3.east)-(fev3.west)$), \n2={veclen(\x1,\y1)} in
  node[arrow, name=tst1, right=(1mm of ideation.east),
  anchor=west,
  font=\small, minimum width=\n2-\pgflinewidth, top color=orange!30!black!90,
  bottom color=orange!30,] {TST};

\end{scope}
\draw (0,-1) grid (20,2);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

这就是你要找的吗?

在此处输入图片描述

您的问题是定义minimum width第二个“信号”是什么。这有点棘手……但是,以下代码有效:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}

\usepackage{tikz}
\usetikzlibrary{backgrounds,calc,chains,fit,positioning,shapes,shadows,scopes}

\usepackage[paper=a3paper, landscape=true,margin={1cm,2cm},
            headsep=5mm, headheight=2cm]{geometry}


\begin{document}
\noindent
    \begin{tikzpicture}[
background rectangle/.style = {draw=blue!50,fill=blue!10,
                               rounded corners=5pt, drop shadow},
  show background rectangle,
%
sign/.style = {%
    shape=signal,
    draw,
    minimum height=10mm, 
    minimum width=30mm,
    inner sep=0pt,
    font=\small,
    signal from=west,
    signal to=east,
    signal pointer angle=110,
    anchor=west,
    top color=#1!60!black!90!,
    bottom color=#1!30,
    drop shadow,
    on chain
                            },
  start chain = going right,
node distance = 0mm and 1mm    
                        ]
\node (sep3) [sign=green,signal from=nowhere] {Sept.};                        
\foreach \mois / \Smois in {
      oct3/Oct., nov3/Nov., dec3/Déc.,
      jan3/jan., fev3/fév., mar3/Mars
                            } 
\node (\mois) [sign=green] {\Smois};
%
\draw let   \p1 = ($(oct3.east)-(sep3.west)$), 
            \n1 = {veclen(\x1,\y1)} in
  node (ideation) [sign=brown,signal from=nowhere,
                   above right=0mm of sep3.north west,
                   minimum width=\n1-\pgflinewidth] {Idéation};
%
\draw let   \p1 = ($(jan3.east)-(nov3.north west |- nov3.west)$),%<-- here is the trick
            \n1 = {veclen(\x1,\y1)} in
  node (tst1) [sign=orange,
               right=of ideation,
               minimum width=\n1-\pgflinewidth] {TST};
\draw (0,-1) grid (20,2);
\end{tikzpicture}
    \end{document}

在上面的代码中,我随意地使其更简洁。为此,我引入了颜色选项,然后将“箭头”和“sig”样式合并为一个通用样式,并使用参数signal from=nowhere在本地区分它们。此外,我省略了scope,因为没有任何用途。

相关内容