7

Given this simple scenario:

\documentclass{article}
\usepackage{tikz}
\newcommand\encircle[1]{%
\tikz[baseline=(X.base)] 
   \node (X) [draw, shape=circle, inner sep=0] {\strut #1};}
\begin{document}
\section{Introduction}
\encircle{A}
\end{document}

The output is this: enter image description here

How do I change it so that the circle has a black background and the color of the text inside the circle is white (basically, reversing the colors) ?

7

Use the fill key to set the background colour and the text key to set the text colour; in your application this means fill=black, text=white.

\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\newcommand\encircle[1]{%
  \tikz[baseline=(X.base)] 
    \node (X) [draw, shape=circle, inner sep=0, fill=black, text=white] {\strut #1};%
}
\begin{document}
\encircle{A}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.