In my code, I'm using a lot of expressions like:  #if DEBUG     printf("Some text = %d", param); #endif   I was wondering if it is possible to change it to macro like:   DEBUG("Some text = %d", param);    or at least to:  DEBUG("Some text =", param);   ?
124175
Is it possible to do something like this  #ifdef SOMETHING #define foo // #else #define foo MyFunction #endif   The idea is that if SOMETHING is defined, then calls to foo(...) become comments (or something that doesn't get evaluated or compiled), otherwise it becomes a call to MyFunction.  I've seen __noop used, but I don't believe I can use that.  EDIT(s):  I don't think I can really use a macro here, because MyFunction takes a variable number of arguments.  Also, I'd like to make it so the arguments are NOT evaluated!  (So doing something like commenting out the body of MyFunction doesn't really give me what I need, as the arguments will still be evaluated)
97689
I was thinking about writing a partial derivative macro that has a similar syntax to the . ()  The syntax could be like this:   \D{f}{x} expands to \frac{\partial f}{\partial x} \D{f}{x,y} expands to \frac{\partial^2 f}{\partial x\,\partial y} \D{f}{{x,2},y} expands to  \frac{\partial^3 f}{\partial x^2\,\partial y} et cetera for any number of derivatives.   Bonus points for an optional argument so that for instance   \D[subscript]{f}{{x,2},y} expands to f_{xxy}   I looked at the  package but the syntax is a little tedious.  For instance, to get \frac{\partial^3 f}{\partial x^2\,\partial y} with that package I would need to do \md{f}{3}{x}{2}{y}{}.  And it doesn't generalize to three variables.  Before I dive in I thought I'd ask the hive and see what's been done.
13355
Are C-style macro names subject to the same naming rules as identifiers?  After a compiler upgrade, it is now emitting this warning for a legacy application:  warning #3649-D: white space is required between the macro name "CHAR_" and its replacement text   #define         CHAR_&amp;        38   This line of code is defining an ASCII value constant for an ampersand.  #define   DOL_SN        36 #define   PERCENT       37 #define   CHAR_&amp;        38 #define   RT_SING       39 #define   LF_PAR        40   I assume that this definition (not actually referenced by any code, as far as I can tell) is buggy and should be changed to something like "CHAR_AMPERSAND"?
102347
I am curious as to whether there is an equivalent to the Alt-. command on Mac. On my computer it inserts the following character: ≥, instead of showing the .
27078
I noticed for a while now the following syntax in some of our code:  if( NULL == var){    //... }   or  if( 0 == var){   //... }   and similar things.  Can someone please explain why did the person who wrote this choose this notation instead of the common var == 0 way)?  Is it a matter of style, or does it somehow affect performance?
40427
I'm looking after a macro to write the (La)TeX logo (with parentheses), i.e. something similar to \TeX, \LaTeX, but where the output includes ()'s.
103491
I've been programming in C-derived languages for a couple of decades now.  Somewhere along the line, I decided that I no longer wanted to write:  if (var)    // in C if ($var)   # in Perl   when what I meant was:  if (var != 0) if (defined $var and $var ne '')   I think part of it is that I have a strongly-typed brain and in my mind, "if" requires a boolean expression.  Or maybe it's because I use Perl so much and truth and falsehood in Perl is such a mine-field.  Or maybe it's just because these days, I'm mainly a Java programmer.  What are your preferences and why?
10087
I'd like to output hello world over 20 characters.  printf "%-20s :\n\n" 'hello world!!'  # Actual output hello world!!        :  # Wanted output hello world!!========:   However, I don't want to complete with spaces but with "=" instead. How do I do that?
91330
For programming in C, it is quite common to switch between creating debug- and release-versions by passing a command line argument to the compiler.  I would like to have something similar for pdflatex. Optimally, there would be conditional parts within the source LaTeX file depending on some variable, and then the switching between the versions can be done by somehow setting this variable at the command-line invocation of pdflatex.  Is it possible to achieve something like this? What's the easiest / cleanest way?
11109
I've been having a lot of problems trying to figure out how to use scanf().  It seems to work fine with integers, being fairly straight forward scanf("%d", &amp;i).  Where I am running into issues is using scanf() in loops trying to read input.  For example:  do {   printf("counter: %d: ", counter);   scanf("%c %c%d", &amp;command, &amp;prefix, &amp;input); } while (command != 'q');    When I enter in a validly structured input like c P101, it seems to loop again before prompting me.  This seems to happen even with a single:  scanf("%c", &amp;c)    in a while loop.  It'll do the loop twice before prompting me again.  What is making it loop twice, and how do I stop it? When I enter in less amount of input that programmatically wouldn't have another character or number such as q, pressing enter seems to prompt me to enter more.  How do I get scanf() to process both single and double character entries?
120097
I am trying to create a macro that creates two macros. The first sets a default value and the second creates a macro to redefine the first. I am trying to generalize a common pattern I am using quite a bit.  \newcommand{\mkMac}[1]{% \newcommand{\the#1}{The macro ##1} \newcommand{\#1}[1]{\renewcommand{\the#1}{##1}} }   Usage:  \mkMac{affilation} \affilation{University} Welcome to \theaffilation
78101
Is it possible to see the return value of a method after the line has been run and before the instruction pointer returns to the calling function?  I am debugging code I can't modify (read: don't want to re-compile a third party library), and sometimes it jumps to code I don't have source to or the return expression has side effects that stop me being able to just run the expression in the Display tab.  Often the return value is used in a compound statement, and so the Variables view will never show me the value (hence wanting to see the result before control returns to the calling function).  UPDATE: I can't use the expression viewer as there are side-effects in the statement.
9412
Is it possible to make macros give different results at the beginning of a new sentence? Suppose that I want the macro "\secname" to write "Section" at the beginning of a new sentence, and "section" anywhere else. How can I do so?
53758
In , Herbert uses a macro definition  \def\defpoint#1#{\expandafter\defpoint@i#1;;\@nil}   which Joseph Wright reports as having a "grab to #{" argument. How does this work? Where is it useful? Are there any restrictions? Does it extend in the same way nested macro definitions would? As in, using ##{ if redefining a macro within another one.
105112
I'm trying to use printf to format some pretty output in a bash script  e.g.:    -----------------------   | This is some output |  -----------------------   But I've stumbled over some behavior I don't understand.  $ printf "--"   gives me the error:     printf: usage: printf [-v var] format [arguments]   and   $ printf "-stuff"   results in      -bash: printf: -s: invalid option   So apparently printf thinks I'm trying to pass some arguments while I'm not.  Meanwhile, completely by accident, I've found this workaround:    $ printf -- "--- this works now ----\n"   gives me   --- this works now ----   Can anyone explain this behavior?
19021
On any SE post one can use the backtick symbol ("`") in order to mark some text as being a piece of code, or computer output. For example: void main().  Is there a way to make use of "`" the same way in a LaTeX document?
33213
I have the following printf function:  $ printf '%s %s %s\t%s\n' 100644 blob 8e1e f1.txt 100644 blob 9de7 f2.txt | git mktree   Can anyone please explain what it produces and why? I expected to have equal number of formatting options %s for each argument string but I have a lot more arguments strings here.