6
votes
2answers
149 views

Allowing first undelimited argument to be empty

Consider the following macro definitions: \def\mymacro#1{\mymacroii#1\nil} \def\mymacroii#1#2\nil{% \ifx\\#1\\% empty% \else #1% \fi }% \mymacro{foo}% -> f \mymacro{} \bye This is ...
5
votes
1answer
79 views

How to pass comma in value of a (xkeyval) comma separated list of values at \documentclass level?

At \usepackage level, xkeyval allows us to insert commas in value of a comma separated list of values: it is enough to enclose in braces the values containing commas. For instance, the following MCE ...
6
votes
1answer
251 views

Is there a reason NOT to use \left and \right?

I was reading the mathtools documentation on \DeclarePairedDelimiter, and apparently only the starred version of the command it defines uses \left and \right on the delimiters. This surprised me a ...
4
votes
2answers
155 views

Redefining brackets

In my thesis I'm working with a lot of brackets around fractions and every time I have to use \left( \frac{a}{b} \right). It can get really confusing if i have a long equation and a lot of fractions. ...
9
votes
2answers
179 views

Is it possible to use $ as a macro delimiter?

Experimenting with macro definitions that use strange delimiters (see e.g. this or this question), I thought it would be fun to have a macro that takes an argument of the form "a/b" and turns this ...
9
votes
3answers
262 views

Defining a macro for “real” colored delimiters

I recently looked up J. van Hoorn's question on How to color delimiters in Math Mode, and so I decided to test my LaTeX knowledge by trying to define a new appropriate command: ...
5
votes
1answer
107 views

Using end-of-line delimiter in plain Tex macro

How is it possible to use the end-of-line character as a macro parameter ? I would like something along the lines of : \def\mymacro#1\endlinechar{Content:#1} \mymacro First content \mymacro Second ...
3
votes
2answers
298 views

Macro for Typesetting Semantic Denotations (Linguistics)

I tried to write a macro for typesetting semantic denotations, using the stmaryrd package, but there are a few issues that I would like to resolve. My first attempt at the macro was the following: ...
6
votes
1answer
59 views

Macro limited in scope to the tabular cell in which it is invoked?

How do I reuse cell delimiter of a tabular environment (usually ampersand) for delimiting a macro parameter? Like this (which unfortunately doesn't work): \def\mymacro#1&{#1} ... ...
6
votes
3answers
280 views

Can I have a curly brace as macro argument delimiter?

Is there any trick that allows to have a { in argument delimiters of a macro ? for example, with this definition : \def\start#1\fin{+++#1+++} the call \start coucou\fin{3}4 will display ...
5
votes
1answer
297 views

What's wrong with my braket macro?

Based on egreg's alternate solution to my previous question from which I learned the idea of making characters into macros, I've now defined a different syntax for bra-kets which I actually like even ...
10
votes
1answer
325 views

Macro delimiter

I'd like to have a macro to split up another macro content, with field separator being a space. So: \def\mytext{foo bar} \def\secondof#1 #2{#2} \secondof\mytext What? What do you mean: "runaway ...
4
votes
2answers
212 views

Is there a way to detect `\left` in front of macros?

Is there a way to have a macro optionally prefixed with \left or \right and have it expand differently depending on that? For example, have \bra{x} expand to \langle x |, but \left\bra{x} to ...