Con \newcommand se agregan llaves al cargar un archivo de texto desde una subcarpeta

Con \newcommand se agregan llaves al cargar un archivo de texto desde una subcarpeta

Con \newcommand se agregan llaves al cargar un archivo de texto en una subcarpeta. Creé algunos archivos en 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}

cuando corro

$ 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.

Tenga en cuenta que las llaves alrededor de {texto}, `mydir/{text}.txt' no existen...

¡Gracias por cualquier ayuda!

información relacionada