19

I'm currently using this code

\raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {f}}} 

to get

enter image description here

I'm trying to index the function f inside the box, with say $f_{n}$ but \textcircled doesn't seem to like this. Any suggestions? Thank you!

1 Answers1

42

I'm not sure what you mean by "\textcircled doesn't seem to like this", because

\documentclass{article}
\begin{document} 
\raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {$f_n$}}} 
\end{document}

compiles fine for me. That said, it does look a bit rubbish:

enter image description here

You might consider a little TikZ picture for this situation. You could put the $f_n$ inside a circular TikZ node. The node would adjust its size correctly, depending on its contents, and align correctly on the baseline of the surrounding text.

\documentclass{article}
\usepackage{tikz}

\newcommand\encircle[1]{%
  \tikz[baseline=(X.base)] 
    \node (X) [draw, shape=circle, inner sep=0] {\strut #1};}

\begin{document}
Lorem \encircle{$f_n$} ipsum \encircle{q} dolor \encircle{a} 
sit \encircle{A} amet \encircle{Hello}.
\end{document}

enter image description here