Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

input encodings / CTAN upload / Euro symbol

187 views
Skip to first unread message

GL

unread,
Oct 10, 2012, 5:27:10 PM10/10/12
to
Hello,

I've defined a color whose name is "Caf� Cr�me" (Caff� con Latte)
in a file encoded in ANSI (cp1252).

\expandafter \edef \csname color@Caf� Cr�me\endcsname

did not cause a problem until I compiled with [utf8]{inputenc}
for which >> � << throws the reading of three characters:
>> � C r <<
and an error.

*First question:* is there a requirement for a CTAN upload on the
encoding of .dtx (and thus .sty) files ?

(May be a .dtx (or .sty) should contain only ASCII characters, in
order to be read with any active encoding... ? )


*Second question:* is it possible to change the input encoding on
the fly, depending on the file being read ? (I suppose the answer
will be � yes, but not recommended at all � ;-) )


*Third question:* why the � character is not defined by utf8.def ?

For example:
% ----------------------------------------
\documentclass {book}
\usepackage [T1]{fontenc}
\usepackage [utf8]{inputenc}
\usepackage [official]{eurosym}
\begin{document}
euro : �
\end{document}\endinput
% ----------------------------------------

Leads to :
! Package inputenc Error: Unicode char \u8:� not set up for use with LaTeX.

It's just weird that the euro symbol seems to be missing !

Thanks in advance.

Enrico Gregorio

unread,
Oct 10, 2012, 6:50:57 PM10/10/12
to
GL <goua...@gmail.com> wrote:

> Hello,
>
> I've defined a color whose name is "Café Crème" (Caffè con Latte)
> in a file encoded in ANSI (cp1252).
>
> \expandafter \edef \csname color@Café Crème\endcsname

I don't think it worked. I get

! Missing \endcsname inserted.
<to be read again>
\unhbox
l.5 \expandafter\edef\csname color@Café
Crème\endcsname{}

> did not cause a problem until I compiled with [utf8]{inputenc}
> for which >> é << throws the reading of three characters:
> >> é C r <<
> and an error.

Of course. But for the same reason as before. If you ask
\show é (cp1252 encoding) you get

> é=macro:
->\@tabacckludge 'e.

When the file encoding is UTF-8, "é" is a two-byte combination
(^^c3^^a9>) and the meaning of the first one is

\UTFviii@two@octets ^^c3

(I represent the bytes with the TeX ^^ notation).

Neither `\@tabacckludge` nor `\UTFviii@two@octets` are
legal in a \edef.

> *First question:* is there a requirement for a CTAN upload on the
> encoding of .dtx (and thus .sty) files ?

No.

> (May be a .dtx (or .sty) should contain only ASCII characters, in
> order to be read with any active encoding... ? )

Why?

> *Second question:* is it possible to change the input encoding on
> the fly, depending on the file being read ? (I suppose the answer
> will be « yes, but not recommended at all » ;-) )

{\inputencoding{whatever}\input{myfileinanotherencoding}}

> *Third question:* why the € character is not defined by utf8.def ?

Because the fonts in OT1 or T1 encodings don't have the Euro symbol.

> For example:
> % ----------------------------------------
> \documentclass {book}
> \usepackage [T1]{fontenc}
> \usepackage [utf8]{inputenc}
> \usepackage [official]{eurosym}
> \begin{document}
> euro : €
> \end{document}\endinput
> % ----------------------------------------
>
> Leads to :
> ! Package inputenc Error: Unicode char \u8:€ not set up for use with LaTeX.
>
> It's just weird that the euro symbol seems to be missing !

Since you use eurosym,

\DeclareUnicodeCharacter{20AC}{\euro}

Or do \usepackage{textcomp} that would define \texteuro to which
the UTF character € would be mapped and say

\renewcommand{\texteuro}{\euro}

Ciao
Enrico

Axel Berger

unread,
Oct 12, 2012, 5:28:29 AM10/12/12
to
Enrico Gregorio wrote:
> {\inputencoding{whatever}\input{myfileinanotherencoding}}

I prefer having the non-standard encoding called inside the file to be
input. You're less likely to forget that way.

Enrico Gregorio

unread,
Oct 12, 2012, 9:10:42 AM10/12/12
to
Maybe you can't modify the file to be input; I agree that,
if possible, a file should announce itself in some way, if
used in a mixed environment.

Ciao
Enrico

Guenter Milde

unread,
Oct 15, 2012, 9:33:35 AM10/15/12
to
On 2012-10-10, Enrico Gregorio wrote:
> GL <goua...@gmail.com> wrote:


>> *Third question:* why the € character is not defined by utf8.def ?

> Because the fonts in OT1 or T1 encodings don't have the Euro symbol.

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

>> It's just weird that the euro symbol seems to be missing !

> Since you use eurosym,

> \DeclareUnicodeCharacter{20AC}{\euro}

> Or do \usepackage{textcomp} that would define \texteuro to which
> the UTF character € would be mapped and say

> \renewcommand{\texteuro}{\euro}

Or replace "eurosym" with textcomp and use a font that provides the euro
sign, e.g.

\documentclass{minimal}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\begin{document}
euro : €
\end{document}


Günter

GL

unread,
Oct 17, 2012, 10:29:20 AM10/17/12
to
Yes but the euro symbol of texcomp is horrrrribble !
(would be better if it did not exist at all, imo.
May be TeX users prefer the £ sterling of course...)

Anyway, I'll try to make an example of a problem that can arise
when different encoded files are loaded.

This is why I'm (a priori) not comfortable with the answer made
by Gregorio on the fact that CTAN does not rule the encoding
of .sty files.

Cheers.

Robin Fairbairns

unread,
Oct 17, 2012, 12:21:38 PM10/17/12
to
GL <goua...@gmail.com> writes:

>> g\"unter milder and enrico gregorio were discussing using textcomp
>
> Yes but the euro symbol of texcomp is horrrrribble !
> (would be better if it did not exist at all, imo.
> May be TeX users prefer the £ sterling of course...)

(once, i would have said no-one in their right mind would prefer the
pound, but it seems that i would have been wrong. in some sense.)

> Anyway, I'll try to make an example of a problem that can arise
> when different encoded files are loaded.
>
> This is why I'm (a priori) not comfortable with the answer made
> by Gregorio on the fact that CTAN does not rule the encoding
> of .sty files.

what can ctan do about it? to first order we almost never look at the
packages, just now. we don't have any resources to do anything, and
extending to our r\^oles is likely to achieve nothing more than _even_
slower turn-around of uploads.

i suppose we could hold on to any upload for a week, on the off-chance
we're going to find something wrong with it. but i can't even schedule
a 24-hour delay in announcement, and in future you won't be able to
avoid uploading to cambridge (or whatever my machine is called by then).
--
Robin Fairbairns, Cambridge
sorry about all this posting. i'll go back to sleep in a bit.
0 new messages