Text Formattingcircle around letters

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
abu aasiyah
Posts: 26
Joined: Wed Sep 30, 2009 7:04 pm

circle around letters

Post by abu aasiyah »

Hello,

I want to make a small circle around the letter "N" and "F". These encircled letters will appear in the text. I have tried the command \textcircled{} and it works fine for some letters, but for others the letter is not centered inside the circle. How do I get around this problem ?

Thank you.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

circle around letters

Post by gmedina »

Hi,

in the following code I used the PGF/TikZ package to define a \mycirc command that can be used to enclose its argument in a circle:

Code: Select all

\documentclass{article}
\usepackage{tikz}

\newcommand*\mycirc[1]{%
  \begin{tikzpicture}
    \node[draw,circle,inner sep=1pt] {#1};
  \end{tikzpicture}}

\begin{document}

\mycirc{N}

\mycirc{F}

\end{document}
Feel free to adapt my example according to your needs.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
abu aasiyah
Posts: 26
Joined: Wed Sep 30, 2009 7:04 pm

Re: circle around letters

Post by abu aasiyah »

Hello,

Thank you for your assistance. One questions. How did you get to be so good at latex??
abu aasiyah
Posts: 26
Joined: Wed Sep 30, 2009 7:04 pm

Re: circle around letters

Post by abu aasiyah »

Hey,

I tried you command and it worked. I would like the encircled letters to appear in line with the rest of the text. Any suggestions?

Thanks.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

circle around letters

Post by Stefan Kottwitz »

This is also no problem with TikZ. Here's gmedinas Macro with a modification:

Code: Select all

\newcommand*\mycirc[1]{%
  \begin{tikzpicture}[baseline=(C.base)]
    \node[draw,circle,inner sep=1pt](C) {#1};
  \end{tikzpicture}}
Stefan
LaTeX.org admin
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

circle around letters

Post by gmedina »

abu aasiyah wrote:...Thank you for your assistance...
You are welcome!
abu aasiyah wrote:...One questions. How did you get to be so good at latex??
At least four factors are involved: a good book (The LaTeX Companion, for example), the information contained in CTAN, this board (and CQF.info which regretfully not longer exists) and my love for beautiful texts.
Stefan_K wrote:...Here's Thorstens Macro with a modification...
Thanks Juanjo.

Just kidding...;-)
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Re: circle around letters

Post by Stefan Kottwitz »

Hi gmedina,

sorry for the mistake in name, I must have read another posting of Thorsten right before. Now it's corrected above.

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

circle around letters

Post by localghost »

Another short version of Stefan's idea.

Code: Select all

\newcommand*\circled[1]{%
  \tikz[baseline=(C.base)]\node[draw,circle,inner sep=0.5pt](C) {#1};\!
}

Best regards
Thorsten
Post Reply