# Yen (￥) character (\textyen) in LaTeX - proper encoding

I am trying to type yen (￥) symbol in LateX. I am using UTF8 encoding:

\usepackage[utf8]{inputenc}


I tried to type this directly as ￥. When I try to compile file with pdflatex I get this error:

Package inputenc Error: Unicode char \u8:￥ not set up for use with LaTeX.


When I try to use \textyen command instead of actual character I get:

LaTeX Error: Command \textyen unavailable in encoding OT1.


My question is this:

1. What is proper encoding for yen symbol?
2. Can I use multiple encodings in one file? I want to use UTF8 encoding for all text instead of this yen symbol. Is it possible?

I found one way to do this without changing encoding by using:

\yen


in text, while defining following in preamble:

\def\yen{{\setbox0=\hbox{Y}Y\kern-.97\wd0\vbox{\hrule height.1ex
width.98\wd0\kern.33ex\hrule height.1ex width.98\wd0\kern.45ex}}}


However, I am still curious about doing this with proper encoding.

• Check that you have the line \usepackage[T1]{fontenc} in your code. If this is not working, provide a MWE in your question. – Sveinung Feb 8 '14 at 10:14
• LuaLaTeX and XeLaTeX provide proper Unicode support, not the kind of emulation inputenc does. My i18n texing life definitely became easier after I made the switch. – Crissov Feb 8 '14 at 10:37
• In addition to @Sveinung's suggestion, add \usepackage{textcomp} to enable a fuller range of \text... symbols. Note that using the T1 encoding with fontenc is perfectly consistent with using utf8. The inputenc option specifies the input encoding of the document. The fontenc option specifies the font encoding to use for the output. Two different things. I use T1 with fontenc with utf8 input via inputenc as standard. – cfr Feb 8 '14 at 11:31

I find the Yen symbol provided by the textcomp package with Computer Modern fonts untolerably awful:

Here's a different approach

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}

\newunicodechar{￥}{\textyen}
\DeclareTextCommandDefault{\textyen}{%
\vphantom{Y}%
{\ooalign{Y\cr\hidewidth\yenbars\hidewidth\cr}}%
}

\newcommand{\yenbars}{%
\vbox{
\hrule height.1ex width.4em
\kern.15ex
\hrule height.1ex width.4em
\kern.3ex
}%
}

\begin{document}
￥\textyen
\end{document}


You see that you can input the character directly or with \textyen.

This is very easy to construct with a stack. The parameters that you can adjust are the width of the strokes (1.3ex), the thickness of the strokes (.1ex), and the vertical elevation of the bottom (.4ex) and top (.65ex) strokes. By using dimensions in ex's rather than pt's, it scales appropriately to different font sizes.

\documentclass{article}
\usepackage{stackengine}
\def\yenrule{\rule{1.3ex}{.1ex}}
\def\textyen{\renewcommand\stacktype{L}\stackon[.4ex]{\stackon[.65ex]{Y}{\yenrule}}{\yenrule}}
\begin{document}
\textyen
\end{document}