set -eux

cd verbatim/

mkdir -p output

for i in *.asm; do
    cat <<EOF > $i.tex
\documentclass[varwidth=13.1cm, border={0.0cm 0.0cm 0.0cm 0.0cm}]{standalone}
\usepackage{minted}
\setminted[python]{breaklines, linenos, frame=lines, framesep=2mm, fontsize=\huge, numbersep=5pt}
\standaloneenv{minted}
\begin{document}

\begin{minted}{haskell}
EOF
    cat $i >> $i.tex

    cat <<EOF >> $i.tex
\end{minted}

\end{document}
EOF

    pdflatex -shell-escape -output-directory=output $i.tex
    pdflatex -shell-escape -output-directory=output $i.tex
done


for i in *.glsl; do
    cat <<EOF > $i.tex
\documentclass[varwidth=13.1cm, border={0.0cm 0.0cm 0.0cm 0.0cm}]{standalone}
\usepackage{minted}
\setminted[python]{breaklines, linenos, frame=lines, framesep=2mm, fontsize=\huge, numbersep=5pt}
\standaloneenv{minted}
\begin{document}

\begin{minted}{glsl}
EOF
    cat $i >> $i.tex

    cat <<EOF >> $i.tex
\end{minted}

\end{document}
EOF

    pdflatex -shell-escape -output-directory=output $i.tex
    pdflatex -shell-escape -output-directory=output $i.tex
done

for i in *.c; do
    cat <<EOF > $i.tex
\documentclass[varwidth=13.1cm, border={0.0cm 0.0cm 0.0cm 0.0cm}]{standalone}
\usepackage{minted}
\setminted[python]{breaklines, linenos, frame=lines, framesep=2mm, fontsize=\huge, numbersep=5pt}
\standaloneenv{minted}
\begin{document}

\begin{minted}{c}
EOF
    cat $i >> $i.tex

    cat <<EOF >> $i.tex
\end{minted}

\end{document}
EOF

    pdflatex -shell-escape -output-directory=output $i.tex
    pdflatex -shell-escape -output-directory=output $i.tex
done
