1

Normally you can do $\overset{a}{b}$ which results in :

a above b

Is there a way to do something similar using icons from the fontawesome5 package? if I try $\overset{\faEye}{\faHeartbeat}$ I get the following:

enter image description here

5
  • 1
    Why math mode? Normally I would use a tabular. – Ulrike Fischer May 3 '20 at 21:31
  • I need to place text next to it in a section header. – Mohamed Khamis May 3 '20 at 21:33
  • why should that be a problem? – Ulrike Fischer May 3 '20 at 21:36
  • 1
    You can use \overset, \documentclass{article} \usepackage{fontawesome} \usepackage{amsmath} \begin{document} $\overset{\mbox{\faEye}}{\mbox{\faHeartbeat}}$ or $\overset{\text{\faEye}}{\text{\faHeartbeat}}$ \end{document}, but I'd agree with @UlrikeFischer that there are likely better ways. – user194703 May 3 '20 at 22:04
  • @Schrödinger'scat putting it inside \mbox did the trick. Thanks! do you want to add this as an answer so I would accept it? – Mohamed Khamis May 3 '20 at 22:10
2

One cannot use the font awesome symbols in math mode. So, if you wish to use them in some math construction like \overset, say, you need to switch to text mode. This can be done with \mbox or \text (from amsmath, which also respects the size of the surrounding).

\documentclass{article}
\usepackage{fontawesome}
\usepackage{amsmath}
\begin{document}
$\overset{\mbox{\faEye}}{\mbox{\faHeartbeat}}$ or
$\overset{\text{\faEye}}{\text{\faHeartbeat}}$
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.