如何在不改变节点和文本大小的情况下使节点中的文本加粗?

如何在不改变节点和文本大小的情况下使节点中的文本加粗?

这是原代码和图片:

\documentclass[tikz,border=2pt]{standalone} 
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{xparse}
\usetikzlibrary{positioning}

\tikzset{
    basenode/.style = {
        circle,
        draw,
        inner sep=0pt,
        minimum size=3.5mm,
    },
    rednode/.style = { 
        basenode,
        fill=white,
        text = red,
    },
    bluenode/.style = { 
        basenode,
        fill=white,
        text = blue,
    },
}

\begin{document}

\NewDocumentCommand{\drawchargepair}{ r() r() }{
    % draws two connected charges
    % (#1) position of - charge
    % (#2) relative position of + charge
    \draw (#1) node[bluenode]{${-}$} -- ++(#2) node[rednode]{${+}$};
}
\begin{tikzpicture}[x={(10cm,0)},y={(0,1cm)}]
    \drawchargepair (0,0) (2cm, 0)
\end{tikzpicture}

\end{document}

f6 如果我使用 \textbf{} 来加粗文本,代码和图像如下所示:

\documentclass[tikz,border=2pt]{standalone} 
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{xparse}
\usetikzlibrary{positioning}

\tikzset{
    basenode/.style = {
        circle,
        draw,
        inner sep=0pt,
        minimum size=3.5mm,
    },
    rednode/.style = { 
        basenode,
        fill=white,
        text = red,
    },
    bluenode/.style = { 
        basenode,
        fill=white,
        text = blue,
    },
}

\begin{document}

\NewDocumentCommand{\drawchargepair}{ r() r() }{
    % draws two connected charges
    % (#1) position of - charge
    % (#2) relative position of + charge
    \draw (#1) node[bluenode]{$\textbf{-}$} -- ++(#2) node[rednode]{$\textbf{+}$};
}
\begin{tikzpicture}[x={(10cm,0)},y={(0,1cm)}]
    \drawchargepair (0,0) (2cm, 0)
\end{tikzpicture}

\end{document}

f7 这里有三个问题,第一个减号变短了,而且整体不在圆心,而是在上方位置,第二个减号圆变小了,但是加号圆大小没变,第三个我想让减号比现在粗一点,怎么做?

相关内容