为什么文本没有位于椭圆的中心?
编辑:
正如 pascal974 所说,删除text width=4.3em
效果很好,但这会导致椭圆宽度太大。我该如何解决这个问题?
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, shadows.blur, arrows.meta, shapes}
\tikzset{
shadow/.style={%
preaction={%
fill=black!20, transform canvas={xshift=2.5pt, yshift=-1.5pt}
}
}
}
\tikzstyle{ellip}=[draw,draw=none,ellipse,fill=red!20,text width=4.3em,text badly centered,minimum height=4em]
\begin{document}
\begin{tikzpicture}[node distance=3cm]
\node[ellip,shadow] (n1) {Specification};
\end{tikzpicture}
\end{document}
答案1
您可以使用一个小的负值inner sep
:
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, shadows.blur, arrows.meta, shapes}
\tikzset{
shadow/.style={%
preaction={%
fill=black!20, transform canvas={xshift=2.5pt, yshift=-1.5pt}
}
}
}
\tikzstyle{ellip}=[draw,draw=none,ellipse,fill=red!20,inner sep=-1mm,minimum height=4em]
\begin{document}
\begin{tikzpicture}[node distance=3cm]
\node[ellip,shadow] (n1) {Specification};
\end{tikzpicture}
\end{document}