# Circle Font Awesome Icons

I need to circle font awesome icons. Currently, this is how it looks.

The code for this is:

\usepackage{fontawesome}
\begin{document}
\faEnvelope hello@shubhamrathi.in
\faPhone +91-9985556304
\faGithub srrathi

\end{document}


I need icons to be enclosed in a circle like this:

How should this be done? I'm preferably looking for a solution without pstricks ( one which works with Sharelatex)

• Must the circles all have the same size, or be adjusted to the glyph size? – Bernard Oct 1 '16 at 23:19
• Same Size for all circles. – user3426358 Oct 1 '16 at 23:20
• ICan you please expand the code snippet that you have posted to a full minimal working example. A MWE should compile and be as small as possible to demonstrate your problem. – Andrew Oct 1 '16 at 23:38
• Updated the question with MWE. Thanks for curating the question. – user3426358 Oct 2 '16 at 0:33

Here is a solution based on pstricks. I define a \pscircled{#1} command:

\documentclass{article}
\usepackage[utf8]{inputenc} %
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{fontawesome}
\usepackage{pst-node, auto-pst-pdf}
\usepackage{hyperref}

\newcommand\pscircled[1]{%
\raisebox{-0.315\height}{\begin{postscript}
\end{postscript}}}

\begin{document}

\noindent
\enspace
\pscircled{\faEnvelope}~hello@shubhamrathi.in
\enspace
\pscircled{\faPhone}~+91-9985556304\\
%
\pscircled{\faGithub}~srrathi
\enspace

\end{document}


• I've followed your steps but the icons have disappeared. Please see this sharelatex file: goo.gl/SrsVa4 – user3426358 Oct 2 '16 at 0:30
• Sorry! I forgot to mention, for pstricks commands to work with pdflatex, you have to launch it with the -shell-escape switch. – Bernard Oct 2 '16 at 0:57
• How do you launch with -shell-escapein Sharelatex? – user3426358 Oct 2 '16 at 9:47
• I'm sorry, I don't use Share LaTeX and have no idea. If this is not possible (for security reasons), I suggest you write individual graphic files for each of the circled icons in the classic way (latex -> dvips ->pstopdf) as standalone files, and use them with \includegraphics. For this method, \raisebox{-0.315\height} command can be removed. – Bernard Oct 2 '16 at 10:01
• I see. Writing individual files was always an option but I would prefer a solution that is compatible with Sharelatex too. Nonetheless, this is help. Thanks. – user3426358 Oct 2 '16 at 10:23

A simple solution with \textcircled and \resizebox:

\documentclass{article}
\usepackage{graphicx,fontawesome}
\def\ci#1{\textcircled{\resizebox{.5em}{!}{#1}}}
\begin{document}
\ci{\faEnvelope} hello@shubhamrathi.in\par
\ci{\faPhone} +91-9985556304\par
\ci{\faGithub} srrathi\par
\end{document}

• This caused the icons to shrink a bit. I've found a solution, have posted it below. – user3426358 Oct 2 '16 at 16:42
• @user3426358 The was the idea, so that the circle size is consistent with the size of circles surrounding a normal character. If you want bigger circled icons you can always use a bigger font for the circle and resize the icon accordingly (some like {\Large\textcircled{\resizebox{.6em}{!}{\faDesktop}}} ) but a larger icon does not look very nice, IMHO, at least with single spacing. – Fran Oct 2 '16 at 18:40

With scalerel and stackengine (what else?)

\documentclass{article}
\usepackage{fontawesome}
\usepackage{scalerel,stackengine}
\usepackage{hyperref}
\newcommand\srcircled[1]{%
\stackinset{c}{}{c}{-.2ex}{\scalerel*{$#1$}{x}}{\textcircled{\strut}}}
\begin{document}
\srcircled{\faEnvelope}~hello@shubhamrathi.in\par
\srcircled{\faPhone}~+91-9985556304\par
\srcircled{\faGithub}~srrathi\par
\end{document}


After reading around more on the forum, this answer has helped me get the right solution.

\usepackage{hyperref, tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=1pt] (char) {#1};}}