我需要将 Font Awesome 图标圈起来。目前,它看起来是这样的。
其代码如下:
\usepackage{fontawesome}
\begin{document}
\faDesktop shubhamrathi.in
\faEnvelope [email protected]
\faPhone +91-9985556304
\faGithub srrathi
\faLinkedin /in/shubhamrrathi
\end{document}
我需要将图标括在圆圈中,如下所示:
应该怎么做?我最好寻找一种没有 pstricks 的解决方案(一种与 Sharelatex 兼容的解决方案)
答案1
下面是基于的解决方案pstricks
。我定义一个\pscircled{#1}
命令:
\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}
\Cnodeput[radius=2.3ex](0,0){P}{#1}
\end{postscript}}}
\begin{document}
\noindent
\pscircled{\faDesktop}~\href{www.shubhamrathi.in}{shubhamrathi.in}
\enspace
\pscircled{\faEnvelope}[email protected]
\enspace
\pscircled{\faPhone}~+91-9985556304\\
%
\pscircled{\faGithub}~srrathi
\enspace
\pscircled{\faLinkedin}~/in/shubhamrrathi
\end{document}
答案2
一个简单的解决方案是使用\textcircled
和\resizebox
:
\documentclass{article}
\usepackage{graphicx,fontawesome}
\def\ci#1{\textcircled{\resizebox{.5em}{!}{#1}}}
\begin{document}
\ci{\faDesktop} shubhamrathi.in\par
\ci{\faEnvelope} [email protected]\par
\ci{\faPhone} +91-9985556304\par
\ci{\faGithub} srrathi\par
\ci{\faLinkedin} /in/shubhamrrathi\par
\end{document}
答案3
还有scalerel
(stackengine
还有什么?)
\documentclass{article}
\usepackage{fontawesome}
\usepackage{scalerel,stackengine}
\usepackage{hyperref}
\newcommand\srcircled[1]{%
\stackinset{c}{}{c}{-.2ex}{\scalerel*{$#1$}{x}}{\textcircled{\strut}}}
\begin{document}
\srcircled{\faDesktop}~\href{www.shubhamrathi.in}{shubhamrathi.in}\par
\srcircled{\faEnvelope}[email protected]\par
\srcircled{\faPhone}~+91-9985556304\par
\srcircled{\faGithub}~srrathi\par
\srcircled{\faLinkedin}~/in/shubhamrrathi
\end{document}
答案4
在阅读了论坛上的更多信息后,这个答案帮助我找到了正确的解决方案。
\usepackage{hyperref, tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=1pt] (char) {#1};}}
\circled{\faDesktop}~{shubhamrathi.in}
\circled{\faEnvelope}[email protected]
\circled{\faPhone}~9985556304
\circled{\faGithub}~ShubhamRathi
\circled{\faLinkedin}/in/ShubhamRRathi