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