See https://github.com/koalaman/shellcheck/wiki/SC2028,
https://github.com/koalaman/shellcheck/wiki/SC1004 and
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772388

Index: whizzytex/examples/bin/mkgpic
===================================================================
--- whizzytex.orig/examples/bin/mkgpic
+++ whizzytex/examples/bin/mkgpic
@@ -3,51 +3,49 @@
 header () {
   if [ -n "$1" ]
   then 
-    echo \
-  '\expandafter\ifx\csname SourceFile\endcsname\relax\else\SourceFile{'$1'}\fi'
+    printf %s "\\expandafter\\ifx\\csname\ SourceFile\\endcsname\\relax\\else\\SourceFile{$1}\\fi"
   fi 
-  echo \
-  '\expandafter\ifx\csname Setlineno\endcsname\relax\def\SetLineno{0}\fi'
+  printf %s "\\expandafter\\ifx\\csname\ Setlineno\\endcsname\\relax\\def\\SetLineno{0}\\fi"
 }
 
 process () {
 sed \
- -e '/^.PE/ {
-i\
-.PE\
+ -e '/^.PE/ {'
+'i'\
+'.PE'\
 \\Setlineno=
 =
 d
-}' $1 | gpic -t 
+'}' "$1" | gpic -t
 }
 
-case $# in
+case "$#" in
   0|1)
     exit 1
     ;;
 esac
 
-case $1 in 
+case "$1" in
   -slice)
-     base=`expr "$2" : "_whizzy_\(.*\).tex"`
-     from=_whizzy_$base.new
-     to=_whizzy_$base.tex
-     src=$base.ltx
-     header $src > $to
-     process $from >> $to
+     base=$(expr "$2" : "_whizzy_\(.*\).tex")
+     from=_whizzy_"$base".new
+     to=_whizzy_"$base".tex
+     src="$base".ltx
+     header "$src" > "$to"
+     process "$from" >> "$to"
      ;;
   -file)
-     from=$2
-     case $from in
+     from="$2"
+     case "$from" in
        *.tex) ;;
        *.ltx) 
-          to=`basename $from .ltx`.tex
-          src=$from
-          header $src  > $to
-          process $from >> $to
+          to=$(basename "$from" .ltx).tex
+          src="$from"
+          header "$src"  > "$to"
+          process "$from" >> "$to"
           ;;
      esac
      ;;
 esac
-   
 
+exit 0
