4

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:

\lstset{
    frame=shadowbox,
    rulesepcolor=\color{blue},
    language=bash,
    basicstyle=\fontspec{PT Mono},
    %extendedchars=true,
    %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...

2
  • How about using dirtree to draw the structured diagram? See How to draw a hierarchical structure with edges?
    – Werner
    Commented Oct 25, 2014 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
    Commented Oct 25, 2014 at 11:34

1 Answer 1

2

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.

 \documentclass{article}

 \usepackage{fontspec}

\setmonofont{FreeMono}

 \begin{document}

 \begin{verbatim}
 .
├── Maildir/
└── scripts/
    ├── backup.sh*
    └── OLD/
        ├── backup_cleanup.sh.old
        └── backup.sh.old*

 \end{verbatim}

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

You must log in to answer this question.

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