From f49787d34b3d88f0739926730aaf7543206fbf70 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 9 Mar 2010 19:01:45 +0000 Subject: new script de-macro (12sep08) git-svn-id: svn://tug.org/texlive/trunk@17399 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/support/de-macro/README | 92 ++++++++++++++++ .../texmf-dist/doc/support/de-macro/user-guide.pdf | Bin 0 -> 50828 bytes .../texmf-dist/doc/support/de-macro/user-guide.tex | 119 +++++++++++++++++++++ 3 files changed, 211 insertions(+) create mode 100644 Master/texmf-dist/doc/support/de-macro/README create mode 100644 Master/texmf-dist/doc/support/de-macro/user-guide.pdf create mode 100644 Master/texmf-dist/doc/support/de-macro/user-guide.tex (limited to 'Master/texmf-dist/doc/support/de-macro') diff --git a/Master/texmf-dist/doc/support/de-macro/README b/Master/texmf-dist/doc/support/de-macro/README new file mode 100644 index 00000000000..aee8708d405 --- /dev/null +++ b/Master/texmf-dist/doc/support/de-macro/README @@ -0,0 +1,92 @@ +Copyright 2005 Peter Gacs +Licensed under the Academic Free Licence version 2.1 + + DE-MACRO + +Version 1.3 - this version is much more conservative about deleting + comments and inserting or deleting blank space: tries to + leave in all comments, adds space only when necessary, and + tries not to delete space in the main text. + The motivating comments came from Daniel Webb. +Version 1.2 - a syntactical bug corrected, thanks Brian de Alwis! + + +PURPOSE + +This program can eliminate most private macros from a LaTeX file. +Applications: + - your publisher has difficulty dealing with many private macros + - you cooperate with colleagues who do not understand your macros + - preprocessing before a system like latex2html, which is somewhat + unpredictable with private macros. + +PLATFORM + +This is a Python program, which I only have tried to run under Unix. But +the Unix dependence is minimal (for example all the directory path +references are platform-independent). It should be easy to adapt the +program to Windows, and also to avoid command-line arguments. + +In case your Python is not in /usr/bin, you should change the +top line (the "shebang" line) of the program accordingly. +This top line uses the -O option for python (stands for "optimize"). +Without it, the program may run too slowly. If you do not care for speed, +a number of other complications (the database, the checking for newer +versions) could be eliminated. + +USAGE + +Warning: this documentation contains "less" and "greater" signs. +Important information is lost when it is displayed as html. +Click directly on the README file instead! + +Command line: + +de-macro [--defs ] [.tex] [[.tex] ...] + +Simplest example: de-macro testament + +(As you see, the <> is used only in the notation of this documentation, +you do should not type it.) + +If contains a command \usepackage{-private} +then the file -private.sty will be read, and its macros will be +replaced in with their definitions. +The result is in -clean.tex. + +Only newcommand, renewcommand, newenvironment, and renewenvironment are +understood (it does not matter, whether you write new or renew). +These can be nested but do not be too clever, since I do not +guarantee the same expansion order as in TeX. + +FILES + +.db +-clean.tex +-private.sty + +For speed, a macro database file called .db is created. +If such a file exists already then it is used. +If -private.sty is older than .db then it will not +be used. + +It is possible to specify another database filename via --defs . +Then .db will be used. + +(Warning: with some Python versions and/or Unix platforms, the database +file name conventions may be different from what is said here.) + +For each , a file -clean.tex will be produced. +If -clean.tex is newer than .tex then it stays. + +INPUT COMMAND + +If a tex file contains a command \input{} or \input +then .tex is processed recursively, and -clean.tex +will be inserted into the final output. +For speed, if -clean.tex is newer than .tex +then .tex will not be reprocessed. + +The dependency checking is not sophisticated, so if you rewrite some macros +then remove all *-clean.tex files! + diff --git a/Master/texmf-dist/doc/support/de-macro/user-guide.pdf b/Master/texmf-dist/doc/support/de-macro/user-guide.pdf new file mode 100644 index 00000000000..7e5ea4d8db1 Binary files /dev/null and b/Master/texmf-dist/doc/support/de-macro/user-guide.pdf differ diff --git a/Master/texmf-dist/doc/support/de-macro/user-guide.tex b/Master/texmf-dist/doc/support/de-macro/user-guide.tex new file mode 100644 index 00000000000..0fc17a32e3f --- /dev/null +++ b/Master/texmf-dist/doc/support/de-macro/user-guide.tex @@ -0,0 +1,119 @@ +\documentclass[11pt]{article} + +\topmargin=0in +\oddsidemargin=0.25in +\evensidemargin=0.25in +\textwidth=6in +\textheight=8in + +\setlength{\vfuzz}{4pt} % to ignore trivial vertical overfull boxes +\sloppy + +\usepackage[noBBpl]{mathpazo} +\usepackage{enumerate} + + \begin{document} + + \title{DE-MACRO} + + \author{Copyright 2005-2007 P\'eter G\'acs\\ +Licensed under the Academic Free Licence version 2.1} + +\maketitle + +Version 1.3 - this version is much more conservative about deleting + comments and inserting or deleting blank space: tries to + leave in all comments, adds space only when necessary, and + tries not to delete space in the main text. + The motivating comments came from Daniel Webb. + +Version 1.2 - a syntactical bug corrected, thanks Brian de Alwis! + + \section*{Purpose} + +This program can eliminate most private macros from a LaTeX file. +Applications: + \begin{enumerate}[--] + \item your publisher has difficulty dealing with many private macros + \item you cooperate with colleagues who do not understand your macros + \item preprocessing before a system like latex2html, which is somewhat + unpredictable with private macros. + \end{enumerate} + + \section*{Platform} + +This is a Python program, which I only have tried to run under Unix. +But the Unix dependence is minimal (for example all the directory path +references are platform-independent). +It should be easy to adapt the +program to Windows, and also to avoid command-line arguments. + +In case your Python is not in \verb`/usr/bin`, you should change the +top line (the "shebang" line) of the program accordingly. +This top line uses the \verb`-O` option for python (stands for ``optimize''). +Without it, the program may run too slowly. +If you do not care for speed, +a number of other complications (the database, the checking for newer +versions) could be eliminated. + + \section*{Usage} + +Command line: + \begin{verbatim} + de-macro [--defs ] [.tex] [[.tex] ...] + \end{verbatim} +{\bfseries Simplest example:} \verb`de-macro testament`\\[0pt] +(As you see, the \verb`<>` is used only in the notation of this +documentation, you should not type it.) + +If \verb`` contains a command +\verb`\usepackage{-private}` +then the file \verb`-private.sty` +will be read, and its macros will be +replaced in \verb`` with their definitions. +The result is in \verb`-clean.tex`. + +Only \verb`newcommand`, \verb`renewcommand`, +\verb`newenvironment` and \verb`renewenvironment` are +understood (it does not matter, whether you write \verb`new` or +\verb`renew`). +These can be nested but do not be too clever, since I do not +guarantee the same expansion order as in TeX. + + \section*{Files} + + \begin{verbatim} +.db +-clean.tex +-private.sty + \end{verbatim} +For speed, a macro database file called \verb`.db` is created. +If such a file exists already then it is used. +If \verb`-private.sty` is older than \verb`.db` +then it will not be used. + +It is possible to specify another database filename via \verb`--defs `. +Then \verb`.db` will be used. + +(Warning: with some Python versions and/or Unix platforms, the database +file name conventions may be different from what is said here.) + +For each \verb``, a file \verb`-clean.tex` +will be produced. +If \verb`-clean.tex` is newer than \verb`.tex` +then it stays. + + \section*{Input command} + +If a tex file contains a command \verb`\input{}` or +\verb`\input ` +then \verb`.tex` is processed recursively, and +\verb`-clean.tex` will be inserted into the final output. +For speed, if \verb`-clean.tex` is newer than +\verb`.tex` then \verb`.tex` will not be +reprocessed. + +The dependency checking is not sophisticated, so if you rewrite some macros +then remove all \verb`*-clean.tex` files! + + \end{document} -- cgit v1.2.3