节点大小和对齐

节点大小和对齐

我不明白为什么“idéation”节点比其他两个节点“9 月”和“10 月”更大。

\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}

\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] {Sept.};
    \foreach \mois / \Smois in
    {
      oct3/Oct., nov3/Nov., dec3/Déc.
    } \node[name=\mois, arrow, minimum width=30mm,on chain, font=\small] {\Smois};

  \node[sign, name=ideation, above=(0mm of sept3.north west),
  anchor=south west,
  font=\small, minimum width=2*30mm+1mm, top color=brown!30!black!90,
  bottom color=brown!30,] {Idéation};
\end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

谢谢

答案1

正如评论中已经指出的那样,sept3是asign并且oct3是aarrow并且虽然它们是相同的,但是和minimum width之间的距离不是因为节点“插入”在左侧内部。oct3.eastsetp3.west2*minimum widthsignarrow

您的方案的一个可能的解决方案是使用let来计算新的minimum width,其中

\draw let \p1=($(oct3.east)-(sept3.west)$), \n2={veclen(\x1,\y1)} in ...

\n2将包含所需的最小距离,必须用 进行校正\pgflinewidth

\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}

\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.
    } \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};
\end{scope}
\draw (0,-1) grid (6,2);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

您还可以按照inset这样arrow的形状进行校正(使用一些简单的三角函数):

minimum width=2*30mm+1mm - 5mm/tan(55) + 1\pgflinewidth

如下图所示,给出了正确的宽度。

在此处输入图片描述

相关内容