Tue Apr 12 20:03:21 2011, original submission:
Marc Baudoin wrote, on Tue, 2 Nov 2010 10:22:24 +0100:
Heiko Oberdiek <heiko.oberdiek@googlemail.com> écrit :
> On Mon, Nov 01, 2010 at 06:26:39PM +0100, Marc Baudoin wrote:
>
> > I believe I found a bug in listingsutf8. Consider the attached
> > MWE. The caption is properly displayed when it is above the
> > listing but it is not when it is below. The same listing in a
> > document encoded in ISO 8859-15 has a correct caption in both
> > cases when using the plain listings package. I'm using TeX Live
> > 2010 last updated this morning.
> >
> > Any idea?
>
> The bug is in package listings:
> * caption top: input encoding before \lstinputlisting is used.
> * caption below: input encoding of option `inputencoding' is used.
Holy cow!
> A fix is not easy, especially because utf8.def unhappily defines
> the input characters globally. The other encodings use
> local assignments.
>
> In theory listings would have to close the group where
> \inputencoding is used before the lower caption is set,
> but probably many other macros/registers are reset that are still
> needed.
>
> Perhaps it can remember the current input encoding
> (inputenc: \inputencodingname) and set it before the caption
> is set.
>
> Workaround:
> * Avoiding 8bit characters in below captions,
Which is probably easier and that's what I'll do.
> * or try:
> caption={[text]{\inputencoding{utf8}text}}
Or wait for listings2, which is in beta since nearly a year with
no news from Carsten Heinz since January. Sigh...
Anyway, thank you very much for your help!
|