summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/ctable/doit
blob: ddf387dcf659d12aaee2e721747670c90210a362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash

# doit - make all or some example picture sets.

# Usage: doit      # make them all
#        doit nnx  # make nnx.pdf and snnx.pdf
#
# pictures are numbered 01, 02, etc.
# nn[a-z] has code to typeset a \ctable; for nn[k-z] page layout will be shown
# for each nn[a-z] two pdfs are generated:
#      nn[a-z].pdf for the ctable picture
# and snn[a-z].pdf for the source code verbatim.
# The prefix (s) for source verbatims and (empty) for result files is set by PRE
# Windows users should replace NULL with perhaps "c:/temp/null"
set=${1:-[0-9][0-9][a-z]}
for j in $set; do
   # source verbatim
   { cat <<-'EOD'
	\documentclass{article}
	\usepackage[a4paper,margin=20mm,noheadfoot]{geometry}
	\pagestyle{empty}
	\begin{document}\ttfamily
	\fontsize{10}{12 pt}\selectfont
	\begin{verbatim}
	EOD
	grep -v "remove from source" $j
	cat <<-'EOD'
	\end{verbatim}
	\end{document}
	EOD
   } >s$j.tex

   pdflatex --interaction=nonstopmode s$j.tex >& /dev/null || die "error compiling s$j.tex"
   pdfcrop s$j.pdf s$j.pdf >& /dev/null
   # result
   { echo '\documentclass[twoside]{article}'
     [[ $j =~ [k-z] ]] && echo '\usepackage[papersize={65mm,40mm},showframe,margin=1mm,noheadfoot]{geometry}'
     cat <<-'EOD'
	\usepackage{ctable}
	\usepackage{txfonts}
	\pagestyle{empty}
	\parindent0pt
	\begin{document}
	EOD
     cat $j
     echo '\end{document}'
   } > $j.tex
   pdflatex --interaction=nonstopmode $j.tex >& /dev/null || die "error compiling $j.tex"
   pdfcrop $j.pdf $j.pdf >& /dev/null
done