2

I have been trying to make icons from fontawesome5 monospaced without much success:

\documentclass[12pt]{article}

\usepackage{fontspec}
\usepackage{fontawesome5}

\begin{document}
  \section{MWE}
  The \faIcon{desktop} and \faIcon{mobile} icons should be the same width.
\end{document}

I tried wrapping the \faIcon{} commands in \texttt{}, which did nothing.

Is there a way to do this?

Henri Menke
  • 109,596

1 Answers1

2

The key is to use the "fixed" package option, \usepackage[fixed]{fontawesome5}.

\documentclass[12pt]{article}

%\usepackage{fontspec}
\usepackage[fixed]{fontawesome5}

\begin{document}
  \section{MWE}
  The \faIcon{desktop} and \faIcon{mobile} icons should be the same width.

rmfamily:\\
\faIcon{desktop}\faIcon{desktop}\faIcon{desktop}\faIcon{desktop}\faIcon{desktop}\\
\faIcon{mobile}\faIcon{mobile}\faIcon{mobile}\faIcon{mobile}\faIcon{mobile}

\ttfamily 
ttfamily:\\
\faIcon{desktop}\faIcon{desktop}\faIcon{desktop}\faIcon{desktop}\faIcon{desktop}\\
\faIcon{mobile}\faIcon{mobile}\faIcon{mobile}\faIcon{mobile}\faIcon{mobile}
\end{document}

enter image description here

Note that the fixed widths can vary if, for example, you are in a different font family such as \ttfamily. They will still be fixed width, just a different fixed width from \rmfamily.