summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/notes/makedoc
blob: 66b77b7f65bfb5b2051b575b4e603d2025ab06a5 (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
51
52
53
54
55
56
57
#!/bin/bash
#
# Everything after a `#' is ignored
#
# remove the string `> /dev/null' if you want more log-output
# remove the line containing `batchmode' if you want even more 
#  log-information while running LaTeX
#
#----------------- create a `ltxdoc.cfg': --------------------------

# Make sure that we start with an clean 'ltxdoc.cfg':
echo "" > ltxdoc.cfg

# Put here a (comma-separated) list of options to pass to
# class 'article':
C_OPT=a4paper

# Put here a (comma-separated) list of options to pass to
# package 'notes' (color?):

if [ -n "$C_OPT" ]; then
  echo "\PassOptionsToClass{$C_OPT}{article}" >> ltxdoc.cfg
fi
echo "\\batchmode"                          >> ltxdoc.cfg

# The next lines produce full indexes and change logs
# you may not want those (comment the lines out with
# TeX-comment-character '%'!)
cat >> ltxdoc.cfg <<EOF
% \AtBeginDocument{\RecordChanges}
% \AtEndDocument{\PrintChanges}
\AtBeginDocument{\CodelineIndex\EnableCrossrefs}
\AtEndDocument{\PrintIndex}
\AtEndDocument{\addcontentsline{toc}{section}{Index}}
EOF

# If you do not want any code listings, just documentation, then instead
# of the lines above, uncomment the following:
#echo "\AtBeginDocument{\OnlyDescription}"           >> ltxdoc.cfg

#---------- latex the documentation using `ltxdoc.cfg': --------------

ThisDoc=notes.dtx
Base=notes

echo "1st latex $ThisDoc"
if (latex $ThisDoc > /dev/null); then
  echo "2nd latex $ThisDoc"
  latex $ThisDoc > /dev/null

  echo "makeindex -s gind.ist $Base.idx"
  makeindex -s gind.ist $Base.idx
  echo "3rd latex $ThisDoc"
  latex $ThisDoc > /dev/null
else
  echo "!!! LaTeX ERROR: $ThisDoc. (See $Base.log.)"
fi