Debian Codegraph @

texmf-dist/doc/support/de-macro/README

raw
1 Copyright 2005 Peter Gacs
2 Licensed under the Academic Free Licence version 2.1
3
4 DE-MACRO
5
6 Version 1.4 - Luca Citi made it python2.7 and python3 compatible.
7 Peter Gacs improved the parsing of \input{<filename>},
8 and made @ a letter in the style files.
9 Version 1.3 - this version is much more conservative about deleting
10 comments and inserting or deleting blank space: tries to
11 leave in all comments, adds space only when necessary, and
12 tries not to delete space in the main text.
13 The motivating comments came from Daniel Webb.
14 Version 1.2 - a syntactical bug corrected, thanks Brian de Alwis!
15
16
17 PURPOSE
18
19 This program can eliminate most private macros from a LaTeX file.
20 Applications:
21 - your publisher has difficulty dealing with many private macros
22 - you cooperate with colleagues who do not understand your macros
23 - preprocessing before a system like latex2html, which is somewhat
24 unpredictable with private macros.
25
26 PLATFORM
27
28 This is a Python program, which I only have tried to run under Unix. But
29 the Unix dependence is minimal (for example all the directory path
30 references are platform-independent). It should be easy to adapt the
31 program to Windows, and also to avoid command-line arguments.
32
33 In case your Python is not in /usr/bin, you should change the
34 top line (the "shebang" line) of the program accordingly.
35 This top line uses the -O option for python (stands for "optimize").
36 Without it, the program may run too slowly. If you do not care for speed,
37 a number of other complications (the database, the checking for newer
38 versions) could be eliminated.
39
40 USAGE
41
42 Warning: this documentation contains "less" and "greater" signs.
43 Important information is lost when it is displayed as html.
44 Click directly on the README file instead!
45
46 Command line:
47
48 de-macro [--defs <defs-db>] <tex-file-1>[.tex] [<tex-file-2>[.tex] ...]
49
50 Simplest example: de-macro testament
51
52 (As you see, the <> is used only in the notation of this documentation,
53 you do should not type it.)
54
55 If <tex-file-i> contains a command \usepackage{<defs-file>-private}
56 then the file <defs-file>-private.sty will be read, and its macros will be
57 replaced in <tex-file-i> with their definitions.
58 The result is in <tex-file-i>-clean.tex.
59
60 Only newcommand, renewcommand, newenvironment, and renewenvironment are
61 understood (it does not matter, whether you write new or renew).
62 These can be nested but do not be too clever, since I do not
63 guarantee the same expansion order as in TeX.
64
65 FILES
66
67 <tex-file-1>.db
68 <tex-file>-clean.tex
69 <defs-file>-private.sty
70
71 For speed, a macro database file called <defs-file>.db is created.
72 If such a file exists already then it is used.
73 If <defs-file>-private.sty is older than <tex-file-1>.db then it will not
74 be used.
75
76 It is possible to specify another database filename via --defs <defs-db>.
77 Then <defs-db>.db will be used.
78
79 (Warning: with some Python versions and/or Unix platforms, the database
80 file name conventions may be different from what is said here.)
81
82 For each <tex-file-i>, a file <tex-file-i>-clean.tex will be produced.
83 If <tex-file-i>-clean.tex is newer than <tex-file-i>.tex then it stays.
84
85 INPUT COMMAND
86
87 If a tex file contains a command \input{<tex-file-j>} or \input <tex-file-j>
88 then <tex-file-j>.tex is processed recursively, and <tex-file-j>-clean.tex
89 will be inserted into the final output.
90 For speed, if <tex-file-j>-clean.tex is newer than <tex-file-j>.tex
91 then <tex-file-j>.tex will not be reprocessed.
92
93 The dependency checking is not sophisticated, so if you rewrite some macros
94 then remove all *-clean.tex files!
95