3

When using extended ASCII characters inside the lstlisting environment, i.e. those corresponding to codes 191 - 197 (literally: ┐, └, ┴, ┬, ├, ─, ┼), latex produces the following error:

Package inputenc Error: Unicode char �\lst@EC�\lst@EC� (U+2832C0)(inputenc) not set up for use with LaTeX. ├──

Is there any way to enable the use of such characters inside lstlisting? Using \usepackage[utf8x]{inputenc} instead of \usepackage[utf8]{inputenc} does not solve the problem.

  • Do they work outside of a listlisting environment? In normal text, in \texttt, in a verbatim environment? – Marijn Dec 13 '18 at 15:36
  • 1
    does \usepackage{pmboxdraw} help? – user4686 Dec 13 '18 at 16:17
4

Use pmboxdraw and the literate key for listings. In the documentation for pmboxdraw there is the full list with the LICR names.

\documentclass{article}
\usepackage{listings,pmboxdraw}

\lstset{
  basicstyle=\ttfamily,
  columns=fullflexible,
  keepspaces,
  literate=
  {┐}{\textSFiii}1%
  {└}{\textSFii}1%
  {┴}{\textSFvii}1%
  {┬}{\textSFvi}1%
  {├}{\textSFviii}{1}%
  {─}{\textSFx}1%
  {┼}{\textSFv}1,
}

\begin{document}

\begin{lstlisting}
a b c d e f g
┐ └ ┴ ┬ ├ ─ ┼
\end{lstlisting}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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