Use other font in restricted area won't compile
The problem is in the fact that \email{x}
eventually does
\href{mailto:x}{x}
and \myfont
in the first argument to \href
is wrong. You can work around this with some trick, but the link will be invalid.
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\moderncvicons{awesome}
\newfontfamily\myfont[]{Arial}
\protected\def\myat{{\myfont @}}
\firstname{John}
\familyname{Doe}
\email{someName\myat me.com}
\begin{document}
\maketitle
\end{document}
Here is a better work around that produces a valid hyperlink. Now \email
has an optional argument for specifying formatting instructions, so \maketitle
will do
\href{mailto:[email protected]}{someName{\myfont @}me.com}
which is legal.
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\moderncvicons{awesome}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\makecvtitle}
{\emaillink{\@email}}
{\expandafter\emaillink\@email}
{}{}
\renewcommand{\email}{\@dblarg\fry@fix@email}
\def\fry@fix@email[#1]#2{\def\@email{[#1]{#2}}}
\makeatother
\newfontfamily\myfont[]{Arial}
\firstname{John}
\familyname{Doe}
\email[someName{\myfont @}me.com]{[email protected]}
\begin{document}
\maketitle
\end{document}