Created
November 9, 2012 12:08
-
-
Save dettmering/4045392 to your computer and use it in GitHub Desktop.
Bash: Add all EPS files in the directory to a TeX file
This file contains 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
#!/bin/bash | |
# Puts all eps files in folder in figure environment | |
rm figures.tex | |
echo "\documentclass[a4paper,10pt]{article} | |
\usepackage[utf8]{inputenc} | |
\usepackage{graphicx} % support the \includegraphics command and options | |
\usepackage{epstopdf} | |
\begin{document} | |
" >> figures.tex | |
for f in *.eps | |
do | |
g=$(echo $f | sed 's/\(.*\)\..*/\1/') | |
echo "\begin{figure}[p] | |
\centering | |
\includegraphics[width=\textwidth]{$f} | |
\caption{$f} | |
\label{fig:$g} | |
\end{figure} | |
" >> figures.tex | |
done | |
echo "\end{document}" >> figures.tex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment