2

I try below sample but can not pass compile:

\documentclass{article}
\begin{document}
├── version.txt
└── visible_windows.zip
\end{document}

Error:

! Missing $ inserted.
<inserted text> 
                $
l.4 └── visible_
                windows.zip
? x

content is output of tree command from linux.

5
  • Underscore can be used in regular text, but you have to use a relevant TeX format (no LaTeX:-).
    – wipet
    Commented Nov 20, 2023 at 20:44
  • 1
    @wipet you know that's a misleading comment, it's true that in optex you only need to locally change end of line and not _ and in latex and plain you need to change both, but to suggest that some formats can do this and some not is .... Commented Nov 20, 2023 at 21:39
  • You get many more errors with your code.
    – egreg
    Commented Nov 20, 2023 at 22:10
  • What errors and in what code means egreg?
    – wipet
    Commented Nov 21, 2023 at 5:19
  • @DavidCarlisle I see (at this site) that there is a lot of user mistakes concerned to the fact, that _ is set with catcode 8. This thread is only one example of such mistakes. I know that If you will design a new format from scratch then you don't set the catcode 8 to _ in order to avoid such user mistakes. But, of course, LaTeX must keep old principles.
    – wipet
    Commented Nov 21, 2023 at 5:25

2 Answers 2

5

You probably want something like this:

\documentclass{article}
\usepackage{pmboxdraw}

\begin{document}

\begin{verbatim}
├── version.txt
└── visible_windows.zip
\end{verbatim}

\end{document}

enter image description here

3

In OpTeX, _ is normal character:

\fontfam[stix]

\obeylines
├── version.txt
└── visible_windows.zip

\bye

It generates, what you want.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .