0

I have a latex file that uses some of my own macros (a mix of tex & latex macros). I need to post the latex source, but don't want to expose the macros (some of which are nasty hacks that just get the job done). Is there any way to get a file without these macros, so that they will have been expanded? In programming language jargon one could say that I would like to inline the definitions of specific macros while keeping all else in tact.

There are tools to handle latex macros (defined with \newcommand and \renewcommand), and there is some discussion and a link to a tool that handles tex macros (defined with \def, etc). But the only link for the tex tools is broken.

TeX macros permit one to write tail-recursive loops. Those can be unfolded for specific input. This is what I'm looking for.

  • 1
  • Unfortunately not. I have an iteration in tex that is done using \def to define an inner loop... And the problem is that I use it so many times, that it's impractical to inline it manually. – Mayer Goldberg Jul 25 '15 at 20:31
  • @MayerGoldberg I think you answered yourself. – egreg Jul 25 '15 at 20:49
  • Well, if you mean that the answer is that it cannot be done, then I think this is wrong. If you mean that there is no off-the-shelf tool to do this, you may be correct. In fact, I was answering cfr's comment, who suggested a tool that handles [re]newcommands, i.e., latex macros. There are discussions of such tools for tex macros, but the download links are broken. – Mayer Goldberg Jul 25 '15 at 21:34
  • 1
    If the macro you want to replace does simple things, say text replacement like \newcommand{\foo}[1]{do something with #1}, then there's nothing really complicated (even if you do loops). But if the macro is recursive, then it's not possible in general. – egreg Jul 25 '15 at 21:56
  • I'm not trying to replace the macro "in general": I'm trying to replace its uses in the latex source file, which are specific applications of the macro, where all the arguments are provided. If you know the arguments to a recursive function or macro, there is no reason why it cannot be unrolled and simplified. I'd just settle for unrolling. – Mayer Goldberg Jul 26 '15 at 09:51
  • what are the names of the tools you mention? perhaps someone else can find them if the names are known. – barbara beeton Jul 26 '15 at 13:00
  • The tool that macro expands tex is supposedly a perl script located at:

    http://pages.iu.edu/~thornbuj/src/tme/tme

    But neither the script nor the user are there any longer.

    – Mayer Goldberg Jul 26 '15 at 16:20

0 Answers0