make_primer.sh 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. doconce spellcheck -d .dict4spell.txt *.do.txt
  3. if [ $? -ne 0 ]; then
  4. echo "Abort due to misspellings."
  5. exit 1
  6. fi
  7. doconce format latex basics -DPRIMER_BOOK
  8. doconce format latex implementation -DPRIMER_BOOK
  9. doconce format latex exercises -DPRIMER_BOOK
  10. # fix \code{} in figure captions
  11. doconce replace "Hierarchy of figure elements in an instance of class \code{Vehicle0" "Hierarchy of figure elements in an instance of class \codett{Vehicle0" implementation.p.tex
  12. # Modify syntax in exercises
  13. doconce subst '\\subsection\{' '\\begin{exercise}\n\\exerentry{' exercises.p.tex
  14. doconce subst '\\noindent\nFilename: \\code\{(.+?)\}' 'Name of program file: \\code{\g<1>}.\n\\hfill $\\diamond$\n\\end{exercise}' exercises.p.tex
  15. # Figure refs are wrong
  16. doconce replace "figs-sketcher/" "figs/" *.p.tex
  17. doconce replace "wheel_on_inclined_plane" "wheel_on_inclined_plane_cropped" *.p.tex
  18. # Fix exercises
  19. doconce subst '\\subsection\{' '\\begin{exercise}\n\\exerentry{' $file
  20. doconce subst 'Filename: \\code\{(.+?)\}\.' 'Name of program file: \\code{\g<1>}.\n\\hfill $\\diamond$\n\\end{exercise}' exercises.p.tex
  21. doconce replace Section Chapter *.p.tex
  22. cp basics.p.tex pysketcher_basics.p.tex
  23. cp implementation.p.tex pysketcher_impl.p.tex
  24. cp exercises.p.tex pysketcher_ex.p.tex