0

This is the original code and picture:

\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 If I use \textbf{} to bold the text, the code and image look like this:

\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 There are three problems here. The first minus sign has become shorter, and the whole is not in the center of the circle, but in the upper position. The second minus sign circle has become smaller, but the size of the plus sign circle has not changed. Third, I want to make the sign thicker than it is now, how should I do it?

0 Answers0