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.

With German umlauts I have to define these characters (Typesetting UTF8 listings with German Umlaute) and the following MWE is working:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{listingsutf8}
\lstdefinelanguage{rawtext}{}
\begin{document}
\lstset{extendedchars=true,language=rawtext,basicstyle=\ttfamily,literate=%
    {Ä}{{\"A}}1%
    {Ö}{{\"O}}1%
    {Ü}{{\"U}}1%
    {ä}{{\"a}}1%
    {ö}{{\"o}}1%
    {ü}{{\"u}}1%
    {ß}{{\ss}}1%
} 

\lstinputlisting{test.txt} 
\end{document}

With content of test.txt like:

ÄÖÜäöüß
abcd-1234

However, what can I do for real UTF8 support. I've created a directory with some international UTF8 filenames. They were displayed with a GUI

enter image description here

and also within a UTF8 compatible shell (bash):

logo.jpg
الجزيرة.نت.html
חדשות, ידיעות מהארץ והעולם - עיתון הארץ.html
Βικιπαίδεια.html
Администрация Президента Грузии.html
საქართველოს პრეზიდენტის ადმინისტრაცია.html
深圳航空有限责任公司 官网订票享受票价直减!.html
航空券 予約・空席照会・運賃案内・国内線|ANA.html

But if the output of the ls command is in the file test.txt, the document can not be compiled, because I get errors like

! Package inputenc Error: Unicode char \u8:�\lst@FillFixed@ not set up for use 
with LaTeX.

I'm looking for a rock solid solution to input generated files. As there is no definition, what kind of characters in the source file is used, all kind of UTF8 characters should be possible to use.

share|improve this question
2  
You can use packages like minted or verbments. Both packages uses Pygments to highlight code. –  Marco Daniel Apr 22 '13 at 11:19
3  
listings is an 8-bit package. So if you want to use it you will have to add long lists of literate-declarations (for pdflatex) or char lists (for lualatex/xelatex see eg tex.stackexchange.com/questions/25391/…). Also you will need fonts for all the glyphs (which means imho that pdflatex isn't really an option). Without highlighting you could use xelatex/lualatex + verbatim together with some font which covers unicode. –  Ulrike Fischer Apr 22 '13 at 11:36
    
@UlrikeFischer can you give a hint for such kind of universal font? –  Micha Apr 22 '13 at 12:57
3  
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Mar 1 at 19:16
add comment

1 Answer

up vote 5 down vote accepted

listings is an 8-bit package. So if you want to use it you will have to add long lists of literate-declarations (for pdflatex) or char lists (for lualatex/xelatex see eg The 'listings' package and UTF-8). Also you will need fonts for all the glyphs (which means imho that pdflatex isn't really an option).

Without highlighting you could use xelatex/lualatex + the verbatim environment together with some font which covers unicode see e.g. http://stackoverflow.com/questions/586503/complete-monospaced-unicode-font for such a font.

share|improve this answer
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.