TikZ - 强制将文本置于节点内居中

TikZ - 强制将文本置于节点内居中

我有下面的代码……它实现了我想要的一切,除了底部节点内的“*”没有居中。我想使用像 \ast 这样的符号,但没有成功。同样,左上角和右上角节点上的文本“输入 x”和“输入 y”不在“信号”块的中间。

有什么方法可以让文本强制位于节点的正中间?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,shapes.symbols}

\tikzstyle{decision} = [diamond, draw, fill=blue!20,
    text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]

\tikzstyle{block} = [signal, draw, signal to=south,
    text width=4.5em, rounded corners]

\tikzstyle{line} = [draw, -latex]

\tikzstyle{cloud} = [draw, ellipse, node distance=3cm, minimum height=3em, minimum width=3em]

%\tikzstyle{signal} = [signal, draw, signal to=south]


\tikzset{
  mycustomnode/.style={
    draw,
    single arrow,
    single arrow head extend=0,
    shape border uses incircle,
    shape border rotate=-90,
  }
}

\begin{document}
\begin{tikzpicture}[node distance = 2cm, auto]
    block/.style={signal, draw, signal to=south}]
    % Place nodes
    \node [cloud, line width=2pt] (init) {\huge +};
    \node [line width=2pt, text depth=0.25ex, text width=5em, block, above left of=init, node distance=10em] (inputx) {Input x};
    \node [line width=2pt, block, above right of=init, node distance=10em] (inputy) {Input y};
    \node [line width=2pt, cloud, below of=init, node distance=10em] (*) {\huge *};
    % Draw arrows
    \path[->, line width=2pt]
     (inputx) edge (init)
     (inputy) edge (init);
    \path[->, line width=2pt] ([xshift=1ex]init.south) edge ([xshift=1ex]*.north);
    \path[->, line width=2pt] ([xshift=-1ex]init.south) edge ([xshift=-1ex]*.north);

\end{tikzpicture}
\end{document}

相关内容