The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged


You can just define a new command using \newcommand\macroname[<arg count>]{<replacement>} (arguments are used by #<num>, up to 9 arguments are supported), to get an a bit more powerful interface you can load the xparse package and use \NewDocumentCommand. The following defines a macro that takes a mandatory argument, followed by an optional ...


If this can be a solution for you, I would rather have my codes in their dedicated files (e.g., code.c) and then use this command: \lstinputlisting[style=CStyle]{code.c} Otherwise, there is an answer here: Environment inside \newcommand Edit You can also include several codes from the same file at different places of your document by using the optional ...

Top 50 recent answers are included