С помощью \newcommand фигурные скобки добавляются при загрузке текстового файла из подпапки

С помощью \newcommand фигурные скобки добавляются при загрузке текстового файла из подпапки

С \newcommand фигурные скобки добавляются при загрузке текстового файла в подпапке. Я создал несколько файлов в bash:

$ mkdir mydir
$ echo "This text is in mydir" > mydir/text.txt
$ echo "This text is outside mydir" > text.txt
$ tree
.
├── mydir
│   └── text.txt
├── test.tex
└── text.txt

2 directories, 3 files
$ cat -n test.tex        
     1  \documentclass[12pt]{article}
     2  
     3  \newcommand\inputtexta[1]{\input{{#1}.txt}}
     4  \newcommand\inputtextb[1]{\input{mydir/{#1}.txt}}
     5  
     6  \begin{document}
     7  
     8  \inputtexta{text}  % okay
     9  
    10  \inputtextb{text} % ! LaTeX Error: File `mydir/{text}.txt' not found.
    11  
    12  \input{mydir/text.txt}  % okay
    13  
    14  \end{document}

Когда я бегу

$ pdflatex test.tex 
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) (preloaded format=pdflatex)

...

! LaTeX Error: File `mydir/{text}.txt' not found.

Обратите внимание на фигурные скобки вокруг {text}, `mydir/{text}.txt' не существует...

Спасибо за любую помощь!

Связанный контент