Created
October 27, 2014 10:07
-
-
Save drakezhard/4fe0dde21d0f73ab6ad0 to your computer and use it in GitHub Desktop.
It generates an image grid with hyperlinks in latex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
files = File.open(ARGV.first) do|file| | |
Marshal.load(file) | |
end | |
latex = File.open(ARGV.last,'w') | |
files.each do |x| | |
latex.write("\\hypertarget{#{x[2]}b}{\\phantom{}}") | |
latex.write("\\hyperlink{#{x[2]}a}{") | |
latex.write("\\includegraphics[width=0.25\\textwidth]{#{x[0]}}\n") | |
latex.write("}\n") | |
end | |
latex.write("\\newpage\n") | |
files.each do |x| | |
latex.write("\\hypertarget{#{x[2]}a}{\\phantom{}}") | |
latex.write("\\hyperlink{#{x[2]}b}{") | |
latex.write("\\includegraphics[width=\\textwidth]{#{x[0]}}") | |
latex.write("}\n") | |
latex.write("\\newpage\n") | |
latex.write("\\includepdf[pages=-]{#{x[1]}}\n") | |
end | |
latex.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment