Print box drawing characters with pdfLaTeX
You can use the symbols, if available on the keyboard, or the macros.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pmboxdraw}
\usepackage{newunicodechar}
\newunicodechar{└}{\textSFii}
\newunicodechar{├}{\textSFviii}
\newunicodechar{─}{\textSFx}
\begin{document}
\begin{verbatim}
├── Maildir/
└── scripts/
├── backup.sh*
└── OLD/
├── backup_cleanup.sh.old
└── backup.sh.old*
\end{verbatim}
\end{document}
This is an extension to Herbert's answer and an answer to Tobia's comment.
Package inputenc
with encoding option utf8
allows the use of UTF-8 in TeX input files with 8-bit TeX engines. As prerequisite, the Unicode characters
must be known, how they are mapped to TeX code. The UTF-8 support of inputenc
couples this with the font encoding. Therefore package pmboxdraw
defines an artificial font encoding pmboxdraw
and the related mapping file pmboxdrawenc.dfu
, which is then automatically loaded. This simplifies Herbert's example to:
% arara: pdflatex
\listfiles
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pmboxdraw}
\begin{document}
\begin{verbatim}
├── Maildir/
└── scripts/
├── backup.sh*
└── OLD/
├── backup_cleanup.sh.old
└── backup.sh.old*
\end{verbatim}
\end{document}
Compiled with:
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016)
Version list of \listfiles
:
*File List*
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
fontenc.sty
t1enc.def 2005/09/27 v1.99g Standard LaTeX file
inputenc.sty 2015/03/17 v1.2c Input encoding file
utf8.def 2016/02/28 v1.1s UTF-8 support for inputenc
t1enc.dfu 2016/02/28 v1.1s UTF-8 support for inputenc
ot1enc.dfu 2016/02/28 v1.1s UTF-8 support for inputenc
omsenc.dfu 2016/02/28 v1.1s UTF-8 support for inputenc
pmboxdraw.sty 2011/03/24 v1.1 Poor man's box drawing characters (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
pmboxdrawenc.dfu 2011/03/24 v1.1 UTF-8 support for box drawing characters
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
t1cmtt.fd 2014/09/29 v2.5h Standard LaTeX font definitions
***********
LuaTeX/XeTeX version
LuaTeX and XeTeX support Unicode characters and package inputenc
is deprecated. However, pmboxdrawenc.dfu
can still be used to make the supported
characters active and expand to the symbols:
% arara: xelatex
% or
% arara: lualatex
\documentclass{article}
\usepackage{pmboxdraw}
\begingroup
\def\DeclareUnicodeCharacter#1{%
\begingroup
\lccode`\~="#1\relax
\lowercase{\endgroup
\global\catcode`~=\active
\gdef~%
}%
}%
\input{pmboxdrawenc.dfu}%
\endgroup
\begin{document}
\begin{verbatim}
├── Maildir/
└── scripts/
├── backup.sh*
└── OLD/
├── backup_cleanup.sh.old
└── backup.sh.old*
\end{verbatim}
\end{document}