1

I am creating an anthology of poems and songs, and have a main file where I am using \input to insert separates TeX files which contain the poems.

I was wondering if there was a simpler way of inserting all of the files in alphabetical order based on filename instead of a separate \input for each file?

Could anybody help?


Thank you to for pointing me in the direction of the other questions - they didn't come up when I googled my queries. I am trying to adapt the code in this post but I am getting 2 errors from it. My code is as follows at the moment

\documentclass{minimal}

\makeatletter%
\def \app@exe {\immediate\write18}

\def \inputAllFiles [#1]{%
  \app@exe{cmd /c dir /b *.tex > \jobname.tmp}
  \InputIfFileExists{\jobname.tmp}{}{}
  \AtEndOfDocument{\app@exe{rm -f #1/\jobname.tmp}}}
\makeatother%

\begin{document}

\inputAllFiles{.}

\end{document}

The errors messages I am getting are both on the line with the \inputAllFiles command and say: Use of \inputAllFiles doesn't match its definition and Too many }'s.

I have tried fiddling around with the code, but noting I seem to do helps. Could anybody help to see where I am going wrong?

Nikel King
  • 23
  • 3

1 Answers1

1

I'd write a script in whatever language is handy, which takes the file listing and massages it into (the guts of) the file doing the including.

I'm sure there is a LaTeX way of doing this, but in my extremely humble opinion this kind of solution is doable (and understandable) by mere mortals like myself.

vonbrand
  • 5,473