将 TikZ 节点定位在谱系稍下方

将 TikZ 节点定位在谱系稍下方

在下面代码的输出中,节点位于谱系的顶部。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\setlength\parindent{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt} 

\begin{document}

Here we are trying to animate an internet forum. A user named \emph{Brico} sends a comment. Here it is:
% Here is my futile attempt to lower the node by 1cm =>  [yshift=-1cm]

\begin{tikzpicture}[yshift=-1cm]\node[color=blue,fill=blue,scale=1.0,transform shape] at (0,0.5){\color{white} @Brico};\end{tikzpicture} % The node options may be redundant! 
\, I think Internet is becoming an unfree place each passing day.
% I've added the [below=-0.2cm] to the  node options. No luck.
\end{document}

我想将它放置在线略下方,以便使线居中,就像这样:

在此处输入图片描述

我尝试了几种解决方案,但都不起作用。该怎么办?

答案1

您可以在 TikZ 用户指南第 129 页找到有关如何将节点底部与周围文本对齐的示例

在此处输入图片描述

应用于你的例子:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\setlength\parindent{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt} 

\begin{document}

Here we are trying to animate an internet forum. A user named \emph{Brico} sends a comment. Here it is:
% Here is my futile attempt to lower the node by 1cm =>  [yshift=-1cm]

\begin{tikzpicture}[baseline=(foo.base)]\node[color=blue,fill=blue,scale=1.0,transform shape] (foo) at (0,0.5){\color{white} @Brico};\end{tikzpicture} % The node options may be redundant! 
\, I think Internet is becoming an unfree place each passing day.
% I've added the [below=-0.2cm] to the  node options. No luck.
\end{document}

在此处输入图片描述

相关内容