# how to expand some macros in latex file [duplicate]

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.


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

## marked as duplicate by Sean Allred, Svend Tveskæg, Guido, egreg macros StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jul 26 '15 at 5:40

• 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