4

I'm trying to create a command to save me some heartache when writing the rest of this document. What I'm attempting to do is to create a command like \double{-}, which when used will produce:

\llbracket - \rrbracket.

2 Answers 2

6

The other solution is good, and is in general the way that you'd define a command. Just to add on a little bit of handy info -- The mathtools package provides \DeclarePairedDelimiter, which is super useful for exactly this sort of thing. For example,

\DeclarePairedDelimiter\double{\llbracket}{\rrbracket}

defines a command that simply surrounds an argument in double braces like the other answer:

\double{n}

or scale itself with a size parameter like \big:

\double[\Bigg]{x}

or even automatically scale itself to fit whatever's inside:

\double*{\frac{\sum i}{\prod j}}

Chances are this is overkill for whatever you're doing, but it's always nice to know what's available to you, eh?

0
3

Surprisingly easy to do, simply do:

\newcommand{\double}[1]{\llbracket #1 \rrbracket}

Based on: latex newcommand guide

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .