I am trying to show a directory structure of a tree using the listings package like so:
├── controllers
│ ├── application_controller.rb
what I get looks like this:
controllers
application_controller.rb
when I use
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
the error given is:
Package inputenc Error: Unicode char \u8:\lst@FillFixed@\lst@EC not set up for use with LaTeX. [├── ]
trying with utf8x gives:
./directory_listing.txt:1: Package utf8x Error: MalformedUTF-8sequence. [├── ]
and
[U+FFFD][U+FFFD][U+FFFD]
1
controllers
[U+FFFD][U+FFFD][U+FFFD]
2
[U+FFFD][U+FFFD][U+FFFD]
a p p l i c a t i o n _ c o n t r o l l e r . rb
and
âŤIJâŤĂâŤĂ controllers
âŤĆÂăÂă âŤIJâŤĂâŤĂ application_controller.rb
If I do not include the utf8 line.
Is there a way to get it to correctly encode the emdashes, pipes and three way pipes so that they show in the output? (P.s. I need some form of [T1]fontenc or underscores are not displayed correctly elsewhere.)
Best Answer
There is a work-around, using the
pmboxdraw
package andlistings
'escapechar
command, that allows to insert Latex code in listings environments:There might be Lualatex or XeLaTex solutions to use unicode characters: would that be an option for you?