How to display a directory structure described by text in figure?

My question might be classical.
I’m confusing to display a following text in igure.
Would you give a suggestion?

#figure(
  body: block(
raw(```
-- work
    |--image
    |   |--- myphoto.jpg
    |   |--  dog.png
    |--contents
    |   |-- chapter1.tex
    |   |-- chapter2.tex
    |
    |---report.tex
    |---reference.bib
```)
  ),
  caption: [the structure of the working directory]
) <working_dir>

The raw function takes a string and converts it into raw content. The backticks (```) also create raw content. So the error that your code generates is:

Expected string, found content

So the solution is to remove the call to the raw function:

#figure(
  block(```
  -- work
    |--image
    |   |--- myphoto.jpg
    |   |--  dog.png
    |--contents
    |   |-- chapter1.tex
    |   |-- chapter2.tex
    |
    |---report.tex
    |---reference.bib
```),
  caption: [the structure of the working directory]
) <working_dir>

Thank gezepi for a quick and cool answer!

1 Like

You can also remove the block call:

#figure(
  caption: [the structure of the working directory],
  ```
  -- work
    |--image
    |   |--- myphoto.jpg
    |   |--  dog.png
    |--contents
    |   |-- chapter1.tex
    |   |-- chapter2.tex
    |
    |---report.tex
    |---reference.bib
  ```
) <working_dir>
2 Likes

Hi @masahiro, don’t forget to tick :ballot_box_with_check: one of the responses if you got a satisfying answer. The answer you choose should usually be the response that you found most correct/helpful/comprehensive for the question you asked.

1 Like

Thank ssotoen for a simple and easy to use advice. you for ssotoen. It;s simple and easy to use.

Thank SillyFrea for comments. I must learn more how to ask Questions.