Is it possible to write a macro such as the following: putcharX(repeat, char)  ==&gt;  putcharX(5, '*');  ==&gt;  putchar('*'); putchar('*'); putchar('*'); putchar('*'); putchar('*');  Note: I'm not looking to use a for/while/do loop, but literally copy the command n number of times in the code. Is such a thing possible with the cpp?
121307
I am asking this question from an educational/hacking point of view, (I wouldn't really want to code like this).  Is it possible to implement a while loop only using C preprocessor directives. I understand that macros cannot be expanded recursively, so how would this be accomplished?
15010
I want to insert 'n' spaces (or any string) at the beginning of a string in C++. Is there any direct way to do this using either std::strings or char* strings?  E.g. in Python you could simply do  &gt;&gt;&gt; "." * 5 + "lolcat" '.....lolcat'
117499
In my daily life I'm always typing &lt;kbd&gt;Keyboard Character&lt;/kbd&gt; and I'd like to set up a macro in Ubuntu to automatically enter &lt;kbd&gt; &lt;/kbd&gt;.  I'd like to assign it to say Shift+Control+K or whatever keyboard control character combination isn't assigned and already used by Ubuntu.  Back in the day of TSR (Terminate and Stay Resident) MS-DOS programs this was possible. Certainly it must be in Ubuntu too?  Do I have to write a daemon to accomplish this?    I found other questions with no answers: ,   I found a similar question with an answer: . However that question stipulated the answer could not be AutoKey.
10083
Is there a way to define a macro that contains a #include directive in its body?  If I just put the "#include", it gives the error  C2162: "expected macro formal parameter"   since here I am not using # to concatenate strings. If I use "\# include",  then I receive the following two errors:  error C2017: illegal escape sequence error C2121: '#' : invalid character : possibly the result of a macro expansion   Any help?
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?
107566
Are there any preprocessor symbols which allow something like  #if CLR_AT_LEAST_3.5 // use ReaderWriterLockSlim #else // use ReaderWriterLock #endif   or some other way to do this?
1654
How to define a command which replaces every instance of a certain character in its argument with another certain character?  For example, I'd like to define the command \myreplace{1-2-abc-345} which gives me the output 1.2.abc.345 by replacing every - with ..
44041
I am new to Vim. I'm following  tutorials to help me learn to use it.  But some of my commands are not working, for example:  Capital W. f followed by a character. (To move to next same char.)   Why is this happening and how can I get these commands to work?
39710
Is it possible to create a counter that is a "slave" to another (master) counter, but also an exact duplicate?  The \@addtoreset{&lt;slave&gt;}{&lt;master&gt;} resets &lt;slave&gt; whenever &lt;master&gt; is incremented (similar functionality is offered by ), but I don't know about anything incrementing one counter (&lt;slave&gt;) automatically whenever another counter (&lt;master&gt;) is incremented.  The idea is to have a macro (say) \dupcntr{&lt;slave&gt;}{&lt;master&gt;} as an analogue to \@addtoreset. The application for this might be where one is interested in renaming a counter used/provided by a package into something more meaningful for the user (say, &lt;slave&gt;), without having to reference &lt;master&gt;. Or, if the original counter contains @ that needs to be escaped every time it's used, it is sometimes more convenient to have a "more user friendly" counter.  I know one way around is to use a macro that returns the value of &lt;master&gt;, but is it possible to perform the same manipulation with a macro than one could with the counter? Manipulation here refers to the printing of the counter (via \the&lt;slave&gt;) and perhaps it's representation (like \arabic, \alph, ...).
8464
How do you concatenate characters in java? Concatenating strings would only require a + between the strings, but concatenating chars using + will change the value of the char into ascii and hence giving a numerical output. I want to do System.out.println(char1+char2+char3... and create a String word like this.  I could do   System.out.print(char1); System.out.print(char2); System.out.print(char3);   But, this will only get me the characters in 1 line. I need it as a string. Any help would be appreciated.  Thanks
72828
Is there a way to use newcommand or some other nice technique to transform any occurence of  "bla"   in math mode into  \text{bla}   The reason I ask is because it is easy, and doesn't interrupt the flow of reading the (La)TeX code as much.  I would like to keep Xe(La)TeX's nice quote behavior (ie it can use the regular "" instead of backticks to quote some text outside math mode).
40007
I've seen documentation whereby an \alph command is put around the \begin{enumerate} somewhere, but I'm not entirely sure how that operates...
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)
107627
Is it the same convention as those used in known programming languages such as Java and C? I'm trying to create a lot of variables and I want it to start with a number, but I'm not sure if it's okay.
58889
I am learning Perl, so please bear with me for this noob question.   How do I repeat a character n times in a string?   I want to do something like below:  $numOfChar = 10;  s/^\s*(.*)/' ' x $numOfChar$1/;
12751
Various constructions can cause TeX (aka the lion) to go into an infinite loop. The simplest example is \def~{~}~, which defines ~ to expand to itself, then expands it. Now, if we exclude macro expansion, getting a loop is more difficult. With pure TeX, the two shortest methods I found (without macros) are  \everypar{\the\everypar}. \toksdef~0~{\the~}\the~.   (including the trailing dots); note that the second is not macro expansion, but the expansion of \the\toks0 in hiding. With eTeX, I got down to  \if\unexpanded\fi   which has the additional "quality" of being expandable. Here, \unexpanded could be replaced by \detokenize or \scantokens.   Why does that trigger an infinite loop? Is there a similarly short TeX constructions which does not use macro expansion (preferably only primitives)?
21123
Would like to have each line in a file repeated a fixed number of times.  e.g. have each line repeated four times:  a b c   becomes:  a a a a b b b b c c c c   I've done some searching, and there are a lot of questions and answers along the lines of doing the reverse, e.g. merging duplicate lines into single lines, and maybe a few about doubling lines by printing them again.  It would be easy to do this in C, but I wish I knew more about the native commands so I wouldn't have to resort to these kinds of one-off throw-aways all the time.