Text FormattingA circle around one or two letters

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
PK_TeX
Posts: 7
Joined: Fri Oct 18, 2024 7:53 am

A circle around one or two letters

Post by PK_TeX »

Hi,

I need to circle one or two letters, and the letters can be either a capital letter (only one in this case), a digit or two digits.

I used

\def\NRU#1{
\tikz\node[circle,draw,inner sep=1pt,outer sep=1pt]{\scriptsize #1};}

\def\NRD#1{
\tikz\node[circle,draw,inner sep=1pt,outer sep=1pt]{\tiny #1};}

And I have in my text

\NRU{S}, \NRU{1}, \NRU{2} \NRD{13}, \NRD{23} and \NRD{24}

Of course, I want the circleds letters be integrated perfectly in the line (without adding spacing).

My solution is quite good, but there is a slight difference between one and two digits.

Is it a solution for centering and reducing the letters in any cases?

Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply