I have some output from the tree command, which looks something like this:

├── Maildir/
└── scripts/
    ├── backup.sh*
    └── OLD/
        ├── backup_cleanup.sh.old
        └── backup.sh.old*

However, when I copy this into my XeLaTeX document, it ends up similar to this in it's final form:

??? Maildir/
??? scripts/
    ??? backup.sh*
    ??? OLD/
        ??? backup_cleanup.sh.old
        ??? backup.sh.old*

Having done some searching, I've tried using the verbatim, Verbatim, and VerbatimOut environments, however none have successfully presented it. I have also tried using the lstlisting which is what I would prefer to use as I'm using it elsewhere in the document, though that hasn't made any difference. My lstlisting environment is set up like this:

    basicstyle=\fontspec{PT Mono},
    %literate={á}{{\'a}}1 {ã}{{\~a}}1 {é}{{\'e}}1,

Those last two lines I found here, and had hoped that I could find the equivalent escape codes for all the extra symbols, however after a couple of hours of searching, I have failed.

How can I get this structure into my document as text (I'd prefer not to import is as an image)?

Many thanks

EDIT 04/11/14: It turns out that in its default installation, TeXShop saves files in Wester (Mac OS Roman), and when I saved and reopened the file, it had replaced the 'special' files with ???. So changing it all to UTF-16, I can now save and reopen to see the 'special' characters, but when I typeset my document it just shows whitespace...

  • How about using dirtree to draw the structured diagram? See How to draw a hierarchical structure with edges? – Werner Oct 25 '14 at 8:53
  • That looks quite promising. I think I'd need to parse the output of my tree command somewhat to input the numbers as I've got considerably more items than I showed in my example above. But should give me something to work with, thank you :) – forquare Oct 25 '14 at 11:34

The main issue is whether the font used for typesetting has the needed characters in it.

The example below works on a linux system. Using Microsoft's truetype fonts also works using \setmonofont{Courier New}, instead.





├── Maildir/
└── scripts/
    ├── backup.sh*
    └── OLD/
        ├── backup_cleanup.sh.old
        └── backup.sh.old*


  • I've changed the font to Courier New, but when I typeset it I get whitespace (see updated question) – forquare Nov 4 '14 at 18:22
  • Is this the case using my example above as well, or only your own file. – Nigel Nov 4 '14 at 18:28
  • It works with your example. Meaning something is broken with either my encoding, or the contents. Combing time! – forquare Nov 4 '14 at 18:31
  • If that's the case, then perhaps you'd consider marking my response as a correct answer. – Nigel Nov 4 '14 at 18:36
  • I use the \setmonofont{Courier New}, and build this example under Xelatex, and it get the correct result. – ollydbg23 Jan 29 '18 at 4:32

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.