18 questions linked to/from Macros with # as the last parameter
468 views

### A “#1#” argument. What is the meaning of the second hash? [duplicate]

In an answer to this question Automatically replace environment align by equation+aligned combination egreg uses \def\relaxtag#1#{\relaxrelaxtag} \def\relaxrelaxtag#1{} The role of the second # is ...
9k views

### How to automatically hyphenate within \texttt?

This question was phrased as a bug report for LaTeX and I thought it would be helpful to be presented here (including an answer). The person had a lot of "common words" in typewriter font sprinkled ...
2k views

### Are there purely expandable variants of \MakeUppercase?

\MakeUppercase and \uppercase use TeX's uccode, and they are not purely expandable. Say, \edef\temp{\MakeUppercase{abc}} will fail. Sometimes purely expandable macros are very useful. They are ...
2k views

### TeX macro idioms, or: understanding advanced macros

I often find that when I look at solutions from the experts here, the macro definitions are completely inscrutable to me. Trying to use standard techniques one would use to understand code in most ...
2k views

### What is the differences between mathcode and catcode and how can I use mathcode?

The command \catcode is often used to change some internals. E.g. the command \makeatletter changes the catcode @. But what is \mathcode and how does it work? catcodes are well explained here: Wiki ...
2k views

### How to define a macro to create a new macro with a name passed as its argument?

I want to define a macro \create that accept a single mandatory argument from which another new macro is created and named. The following code snippet may speak clearer what I want to achieve. But ...
2k views

### Why does TeX remove braces around delimited arguments?

On pp. 203–204 of the TeXbook, Knuth describes how TeX absorbs macros' arguments: delimited go until the first appearance of the delimiter, and undelimited go until the next token, in both cases ...
1k views

### Can one define an expandable command that removes control sequences from its argument?

I am trying to create an expandable command that accepts a single argument that may contain control sequences, and expands to that same argument with all control sequences and braces removed. That is: ...
16k views

### Colored symbols

First of all, I apologize if this is a repetitive question. I searched, but couldn't find it. I was wondering if I can change the color of symbols in latex. For example \ast always give me a black ...
2k views

### Parse simple arithmetics and return the result

I want a command \ca which takes a simple arithmetic calculation as an argument and returns the result with proper decimal places. Additionally I want an boolean argument which decides if only the ...
1k views

### Expandable full expansion of tokens that preserves catcodes

Is it possible to fully expand tokens in an expandable manner and preserves category codes? I'd like to do this just using pdfTeX. I'm looking for something that would work like this: \def\foo{foo} \...
992 views

### The revenge of the vboxes

Yes, they're back. With a vengeance. Those pesky little buggers we call \vboxes which I've fought against previously. (And Bruno, too.) \parskip=0pt \def\unquo{\unvbox0\smallskip} \def\bquo#{\...
422 views

### “Grab to #{” macro arguments

In How to create a macro with two or three ;-separated arguments?, Herbert uses a macro definition \def\defpoint#1#{\expandafter\defpoint@i#1;;\@nil} which Joseph Wright reports as having a "grab to ...
833 views

### Apply formatting to outermost parentheses

I have some text information where I need to apply a text format to all the outer most parentheses such as making them larger and/or bold. In a sense I want to process text like ^(...(...(...)...)......
162 views

### Using a character as a macro within another macro in (La)TeX

Goal: What I would like to do is to allow _ and ^ to be used to generate sub and superscripts in text mode only within a specific macro. I know that I can make _ and ^ active throughout the document, ...

15 30 50 per page