#!/bin/bash

types=( R I )
repartitions=( 1 N )
ratios=( 10:1 1:1 1:10 )
platforms=( cluster grid )
topologies=( line torus hcube )

cat <<EOF
\\documentclass[a4paper]{article}

\\usepackage[T1]{fontenc}
\\usepackage[utf8]{inputenc}
\\usepackage{lmodern}
\\usepackage[margin=1.5cm]{geometry}
\\usepackage{graphicx}
\\usepackage[francais]{babel}

%%% workaround warnings about PDF 1.5 not supported
\\pdfminorversion 5

\\AtBeginDocument{\\shorthandoff{:}}

\\newcommand{\\IG}[1]{%
  \\includegraphics[width=6cm]{#1}}

\\begin{document}

EOF

for typ in "${types[@]}"; do
    for rat in "${ratios[@]}"; do
        cat <<EOF
\\begin{figure}
  \\centering
EOF
        for rep in "${repartitions[@]}"; do
            for pla in "${platforms[@]}"; do
                for top in "${topologies[@]}"; do
                    cat <<EOF
  \\IG{graphs/${typ}${rep}-${rat}-${pla}-${top}.pdf}%
EOF
                done
                cat <<EOF

EOF
            done
        done
        case $typ in
            I) m="Integer";;
            R) m="Real";;
            *) m="??? $typ ???";;
        esac
        cat <<EOF
  \\caption{$m mode, comp/comm ratio\${} = $rat\$.}
\\end{figure}
\\clearpage

EOF
    done
done

cat <<EOF
\end{document}
EOF