Page Layout ⇒ Include all Figures on single Pages in Appendix
Include all Figures on single Pages in Appendix
Is there a LaTeX package that simply adds every single image that has ever been included previously by an \includegraphics command, on a separate page?
Thanks in advance.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
-
kaiserkarl13
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Include all Figures on single Pages in Appendix
Code: Select all
#! /bin/bash
graphicfile=allfigs.tex
if [[ ! -r "$1" && ! -r "$1.tex" ]]; then
echo 1>&2 "Usage: `basename $0` filename
OR
`basename $0` filename.tex"
exit 1
fi
rm -f $graphicfile
if [[ -r "$1.tex" ]]; then
infile="$1.tex"
else
infile="$1"
fi
includedfiles=$(grep '\\\(include\|input\)\s*{' "$infile" | grep -v '%.*\\\(include\|input\)' | sed 's/.*\\\(include\|input\){//' | sed 's/}.*$//' | tr "\n" " " )
for file in "$infile" $includedfiles; do
if [[ "$file" = `basename $graphicfile .tex` || "$file" = $graphicfile ]]; then
true # do nothing
elif [[ -r "$file" ]]; then
imagefiles=$(grep "\\includegraphics" $file | grep -v "%.*\\includegraphics" | tr '\r' '\n')
for graphic in $imagefiles; do
echo >> $graphicfile "
\\clearpage
$graphic"
done
elif [[ -r "$file.tex" ]]; then
imagefiles=$(grep "\\includegraphics" "$file.tex" | grep -v "%.*\\includegraphics" | tr '\r' '\n')
for graphic in $imagefiles; do
echo >> $graphicfile "
\\clearpage
$graphic
"
done
fi
done
Code: Select all
\appendix
\input{allfigs}
The script is "smart" enough to handle you leaving off the extensions of included files (or not), and it also won't search through "allfigs.tex" for included graphics. All other included or inputted files will be parsed.