8

I wanted to use some symbols from marvosym but they don't seem to work in my distribution.


\documentclass{article}
\usepackage[english]{babel}
\usepackage{marvosym}

\begin{document}

$\Bat$
$\Bicycle$
$\Coffeecup$ 
$\Frowny$ 
$\Heart$
$\Industry$ 
$\Football$
$\Mobilefone$
$\Smiley$
$\Womanface$
$\Gentsroom$
$\Ladiesroom$
$\Taurus$
$\Sagittarius$
$\WomanFace$
$\ManFace$
$\Yingyang$
\end{document} 

I get a PDF output like:

enter image description here

Log highlights:

  This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9 64-bit) (preloaded format=pdflatex 2013.12.5)

  ...

  ("C:\Program Files\MiKTeX 2.9\tex\latex\base\fontenc.sty"
  Package: fontenc 2005/09/27 v1.99g Standard LaTeX package
  ("C:\Program Files\MiKTeX 2.9\tex\latex\base\t1enc.def"
  File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file
  LaTeX Font Info:    Redeclaring font encoding T1 on input line 43.
  ))

  ...

  ("C:\Program Files\MiKTeX 2.9\tex\latex\marvosym\marvosym.sty"
  Package: marvosym 2011/07/20 v2.2 Martin Vogel's Symbols font definitions
  )

  ...

  LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 6.
  LaTeX Font Info:    ... okay on input line 6.
  LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 6.
  LaTeX Font Info:    ... okay on input line 6.
  LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 6.
  LaTeX Font Info:    ... okay on input line 6.
  LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 6.
  LaTeX Font Info:    ... okay on input line 6.
  LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 6.
  LaTeX Font Info:    ... okay on input line 6.
  LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 6.
  LaTeX Font Info:    ... okay on input line 6.
  LaTeX Font Info:    External font `cmex10' loaded for size
  (Font)              <7> on input line 8.
  LaTeX Font Info:    External font `cmex10' loaded for size
  (Font)              <5> on input line 8.
  LaTeX Font Info:    Try loading font information for U+mvs on input line 8.

  ("C:\Program Files\MiKTeX 2.9\tex\latex\marvosym\umvs.fd")
  Missing character: There is no ý in font cmr10!
  Missing character: There is no ® in font cmr10!
  Missing character: There is no § in font cmr10!
  Missing character: There is no Œ in font cmr10!
  Missing character: There is no © in font cmr10!
  Missing character: There is no þ in font cmr10!
  Missing character: There is no á in font cmr10!
  Missing character: There is no è in font cmr10!
  Missing character: There is no þ in font cmr10!
  Missing character: There is no ÿ in font cmr10!

I'm using TeXstudio 2.6.6. My MiKTeX package manager has a load-on-demand setup so maybe I'm missing packages with other fonts? At the moment I'm pretty clueless how to solve these missing character errors (I presumed they would be installed with the package).

Any ideas how can I solve this?

(I hope the question is not too localised but I do have a pretty standard setup.)

badroit
  • 7,557

2 Answers2

12

The symbols can't be used in pure math mode. Remove the $...$ around it or wrap \text{} around the symbol macro name (\usepackage{amsmath}) then.

\documentclass{article}
\usepackage[english]{babel}
\usepackage{marvosym}

\begin{document}

\Bat
\Bicycle
\Coffeecup 
\Frowny 
\Heart
\Industry 
\Football
\Mobilefone
\Smiley
\Womanface
\Gentsroom
\Ladiesroom
\Taurus
\Sagittarius
\WomanFace
\ManFace
\Yingyang
\end{document} 

enter image description here

6

The symbol commands of marvosym are text mode commands, as explained in Christian Hupfer's answer.

Since marvosym's symbol macros are defined based on the more lower level macro \mvchr, these macros can be easily patched to get them work in math mode, e.g.:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{marvosym}

\usepackage{amstext}
\usepackage{etoolbox}
\pretocmd\mvchr{\text}{}{\errmessage{Patching \noexpand\mvchr failed}}
\pretocmd\textmvs{\text}{}{\errmessage{Patching \noexpand\textmvs failed}}

\begin{document}

$\Bat$
$\Bicycle$
$\Coffeecup$
$\Frowny$
$\Heart$
$\Industry$
$\Football$
$\Mobilefone$
$\Smiley$
$\Womanface$
$\Gentsroom$
$\Ladiesroom$
$\Taurus$
$\Sagittarius$
$\WomanFace$
$\ManFace$
$\Yingyang$
\end{document}

Result

Heiko Oberdiek
  • 271,626
  • Thanks for the added info! I didn't need them in math mode, it was just a reflex to do that for a symbol. :) – badroit Sep 05 '14 at 00:10