Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{minimal}
- makeatletter
- defapp@exe{immediatewrite18}
- definputAllFiles#1{%
- app@exe{ls #1/*.txt | xargs cat >> jobname.tmp}%
- InputIfFileExists{jobname.tmp}{}
- AtEndDocument{app@exe{rm -f #1/jobname.tmp}}}
- makeatother
- begin{document}
- inputAllFiles{.}% from the current dir
- end{document}
- documentclass{article}
- newcommand*{MaxNumOfChapters}{10}% Adjust these two settings for your needs.
- newcommand*{MaxNumOfSections}{6}%
- usepackage{pgffor}%
- begin{document}
- foreach c in {1,2,...,MaxNumOfChapters}{%
- foreach s in {1,2,...,MaxNumOfSections}{%
- IfFileExists{Chapterc/Sections} {%
- input{Chapterc/Sections}%
- }{%
- % files does not exist, so nothing to do
- }%
- }%
- }%
- end{document}
- newcommand*{ListOfFiles}{%
- Chapter1/Section1,
- Chapter1/Section2,
- Chapter1/Section3,
- Chapter2/Section1,
- Chapter2/Section2
- }%
- documentclass{article}%
- usepackage{pgffor}%
- input{ListOfFiles}%
- begin{document}%
- foreach c in ListOfFiles {%
- input{c}%
- }%
- end{document}
- directlua{dofile("inputall.lua")}
- bye
- function dirtree(dir)
- if string.sub(dir, -1) == "/" then
- dir=string.sub(dir, 1, -2)
- end
- local function yieldtree(dir)
- for entry in lfs.dir(dir) do
- if not entry:match("^%.") then
- entry=dir.."/"..entry
- if lfs.isdir(entry) then
- yieldtree(entry)
- else
- coroutine.yield(entry)
- end
- end
- end
- end
- return coroutine.wrap(function() yieldtree(dir) end)
- end
- for i in dirtree(lfs.currentdir()) do
- local filename = i:gsub(".*/([^/]+)$","%1")
- tex.sprint("\input " .. filename .. " ")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement