#!/bin/sh
# 
if test $# -lt 2; then
 echo "Script to start xdvi with the right size, etc. to fit exactly in a "
 echo "vga/svga/... screen (e.g., for on-line presentations using xdvi and "
 echo " "
 echo "Usage: "
 echo "$2 <vga|svga|xga|sun|sxga|a4paper|letterpaper> <file>.dvi <xdvi_opts>"
 exit
fi
  displaystyle=$1
  shift
  dvifile=$1
  shift
if   [ $displaystyle = sxga+ ]; then 
xdvi -s 4 -bw 1 -cr red -expert -p 600 -geometry 1390x1040-0-0 \
    -sidemargin 0cm -topmargin 0cm -paper 9.31x6.83 \
    -hush $dvifile $*
elif   [ $displaystyle = sxga ]; then 
xdvi -s 5 -bw 1 -cr red -expert -p 600 -geometry 1270x1014-0-0 \
    -sidemargin 0cm -topmargin 0cm -paper 10.55x8.42 \
    -hush $dvifile $*
elif   [ $displaystyle = sun ]; then 
xdvi -s 5 -bw 1 -cr red -expert -p 600 -geometry 1142x890-0-0 \
    -sidemargin 0cm -topmargin 0cm -paper 9.5x7.4 \
    -hush $dvifile $*
elif   [ $displaystyle = xga ]; then 
xdvi -s 6 -bw 1 -cr red -expert -p 600 -geometry 1014x758-0-0 \
    -sidemargin 0cm -topmargin 0cm -paper 10.12x7.56 \
-hush $dvifile $*
#       -display elcano:0.0
elif   [ $displaystyle = svga ]; then 
xdvi -s 7 -bw 1 -cr red -expert -p 600 -geometry 790x590-0-0 \
    -sidemargin 0cm -topmargin 0cm -paper 9.19x6.85 \
    -hush $dvifile $*
#       -display clip2:0.0
elif [ $displaystyle = vga ] ; then 
xdvi -s 9 -bw 1 -cr red -expert -p 600 -geometry 630x470-0-0 \
    -sidemargin 0cm -topmargin 0cm -paper 9.41x7.01 \
        -hush $dvifile $*
#       -display balboa:0.0 
# This is for viewing slides meant to be printed on a4 paper
elif [ $displaystyle = a4paper ] ; then 
xdvi -s 8 -bw 1 -cr red -expert -p 600 -geometry -0-0 \
    -sidemargin 0cm -topmargin 0cm -paper a4r \
        -hush $dvifile $*
#       -display balboa:0.0 
# This is for viewing slides meant to be printed on letter sized paper
elif [ $displaystyle = letterpaper ] ; then 
xdvi -s 8 -bw 1 -cr red -expert -p 600 -geometry -0-0 \
    -sidemargin 0cm -topmargin 0cm -paper usr \
        -hush $dvifile $*
#       -display balboa:0.0 
# This option really a kludge: do not use
elif [ $displaystyle = svgainvga ] ; then 
xdvi -s 8 -bw 1 -cr red -expert -p 600 -geometry 790x470-0-0 \
    -sidemargin 0cm -topmargin 0cm -paper 10.5x6.23 \
        -hush $dvifile $*
#       -display balboa:0.0 
# IBM T30 laptop with 1024x768 resolution
elif [ $displaystyle = t30 ] ; then
       xdvi -s 6 -bw 1 -expert -p 600 -geometry 1024x764-0-0 \
       -sidemargin 0cm -topmargin 0cm -paper 25.8x19.3 \
       -hush $dvifile $*
else 
echo "Usage: $2 <t30|vga|svga|xga|a4paper|letterpaper> <filename>.dvi <xdvi_opts>"
fi
