Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The algorithm2e package seems to be not compatible with LuaLaTeX. For example, compiling the following code produces an error.

\documentclass{article}

\usepackage{fontspec}
\usepackage{algorithm2e}

\begin{document}
foo
\end{document}

Output of lualatex:

...
! String contains an invalid utf-8 sequence.
l.778 \renewcommand{\@algocf@procname}{Proc
                                       �dure}%
? 
! Emergency stop.

Has someone an idea how to fix that? I have a lot of algorithms typeset and do not want to switch to another package just because of LuaLaTeX.

share|improve this question
    
The Package is not in UTF-8 format. If you open it and save it back in UTF-8 format it works (for me). To try, please copy algorithm2e.sty in the same directory, open it with an editor that can save it back in UTF-8. –  Andy Nov 14 '11 at 15:56
    
@Andy. That works too. Thanks for your tip! –  Peter Nov 14 '11 at 16:38
    
@Andy: converting to utf8 will help with lualatex but then you will probably get wrong fix names with pdflatex + an 8bit-option of inputenc. Using non-ascii chars in a sty is simply a bad idea. –  Ulrike Fischer Nov 14 '11 at 17:33
    
@UlrikeFischer. It does not even really work for Lualatex. ProcÈdure does not seem to be quite right when you have to use French. But while you are at it, should one only use ascii and save in UTF-8 or does that not matter so much? –  Andy Nov 14 '11 at 17:46
1  
My version use procédure which is ok for french. A sty should be pure ascii and it doesn't matter how you save it as the result will be the same. ascii chars are encoded identically in utf8, ansinew, latin1 etc. –  Ulrike Fischer Nov 14 '11 at 18:06
add comment

1 Answer

algorithm2e.sty contains (at least) two non-ascii chars (é in procédure), but the file is 8bit encoded so it is not a valid utf8 file. You (or the author) should replace the é by \'e.

share|improve this answer
    
@Peter: Unfortunately there are several other usages of é in that file, so I would try to use search-and-replace. Please don't forget to post a email to the author and mentioning this. It should be fixed for the next release. –  Martin Scharrer Nov 14 '11 at 16:03
1  
Yeah, that did the trick. Substituting all accents solved the problem. I will send an e-mail to the author. Hopefully it will be fixed in the next release. Thanks for all your help! –  Peter Nov 14 '11 at 16:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.