Skip to content

Instantly share code, notes, and snippets.

@maxbeier
Last active August 29, 2015 14:06
Show Gist options
  • Save maxbeier/8bf146d596590f85f20d to your computer and use it in GitHub Desktop.
Save maxbeier/8bf146d596590f85f20d to your computer and use it in GitHub Desktop.
Takes a LaTeX file, replaces all `\input`s with the actual content and combines everything into a single file.
cat input.tex | ruby -pe '$_.match(/[^%]\\input\{(.+?)\}/) { $_ = IO.binread($1 + ".tex") + "\n\r" }' > output.tex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment