I have an external text file that contains a list of names of TeX input files. The names have trailing extensions .tex
.
For example, the external text file named data.txt
contains the following list:
a.tex
b.tex
c.tex
There is a PDF file for each TeX input file in the same directory in which data.txt
exists.
The following codes are expected to iterate the file name without extension and import the corresponding PDF.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\newread\reader
\immediate\openin\reader=data.txt\relax
\loop
\read\reader to \x
\unless\ifeof\reader
\includegraphics{\x}\par
\repeat
\immediate\closein\reader
\end{document}
Could you help me to implement the trimming macro to remove .tex
in \x
?
=SUBSTITUTE(A1;".tex";"")
. Add.tex
whenever required by TeX.xstring
package has\StrBefore
. Using\StrBefore{hello.tex}{.tex}
gives mehello
.