2

I want to print out a directory tree, preferably within the listings package.

The intended content is like this:

ROOT // Root directory.
│
├── flatbuffers // This flatbuffers directo
└── sche

But, on my text editor the box characters join up.

But I cannot make it print, even specifying UTF8 like this:

\lstinputlisting[language={},
nolol=true
,extendedchars=true
,inputencoding=utf8]{tmp.txt}

It produces the 'unrecognised character' signs...

1 Answers1

2

I haven't found out how to do it with the listings package, but maybe a verbatim input of the file is sufficient. The main point is that you have to set up the unicode characters for box drawing.

\usepackage[utf8]{inputenc}
\usepackage{pmboxdraw}

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pmboxdraw}
\usepackage{verbatim} % for verbatim environment and \verbatiminput
\usepackage{sverb} % for \verbinput
\begin{document}

\begin{verbatim}
ROOT // Root directory.
│
├── flatbuffers // This flatbuffers directo
└── sche
\end{verbatim}

\verbatiminput{tmp.txt}

\verbinput{tmp.txt}
\end{document}
gernot
  • 49,614
  • Thank you, this is perfect. To be honest, I was only trying to show I had made an attempt myself in the question! – user3235290 Mar 25 '17 at 21:56