[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: latex: how to output the ¢ (cent) symbol - solved



Michael Laing wrote:
> 
> I have a potato system with all the usual latex stuff on it.
> 
> I am working with a lot of latin1 (ISO-8859-1) text and need to output
> the ¢ (cent) symbol, which is latin1 character number 162 (0xa2). How
> can I do that? Almost all other characters work fine with the latin1
> input encoding.
> 
> Here's a little example document.
> 
> \documentclass[10pt,letterpaper]{letter}
> \usepackage[latin1]{inputenc}
> \usepackage{times}
> \begin{document}
> Yo Günther, a nickle is \$0.05 or 5¢.
> \end{document}
> 
.
.
.

Well I solved it by grep'ing around in the latex directories which
ultimately led me to the TS1 encoding (symbolic companion to T1) which
properly defined the cent symbol. Here's the new text:

\documentclass[10pt,letterpaper]{letter}
\usepackage[latin1]{inputenc}% Input text is encoded in latin 1, so '¢'
is 1 byte: '0xa2'
\usepackage{times}
\usepackage[TS1,T1]{fontenc}% NEW: T1 is the default font encoding, TS1
is allowed
\newcommand{\tsone}{\fontencoding{TS1}\selectfont}%NEW: define a cmd
that sets the TS1 encoding
\begin{document}
Yo Günther, a nickle is \$0.05 or 5{\tsone ¢}.%MODIFIED: use new cmd to
switch encoding for the ¢
\end{document}

latin1 effectively translates '¢' to '\textcent' and TS1 translates it
back again for output.

The .dvi, .ps, and .pdf files look perfect.

This same technique will work for most if not all of the 'funny'
characters in latin1 that are otherwise unsupported or which require
unsightly flipping into math mode, so I am hopeful that I will have a
complete mapping for ISO-8859-1.

If anyone has a simpler method I would like to know of it, as I am not
much of a latex guru!

ml


Reply to: