5

How do I define my own delimiters from arbitrary symbols for math which have these properties:

  • They have a fixed size. Unlike the usual delimiters they do not stretch to adapt to the enclosed content.
  • They do not have to be paired. A left delimiter need not be followed by a right delimiter. A right delimiter need not be preceded by a left delimiter.
  • Each delimiter can be declared to belong to one of the three sides (left, middle, right).

Example 1: I want to use the $ character as a math delimiter. I want to declare a left, a right, and a middle $ delimiter. I want to be able to use just any one, just any two, or all three variants of $ delimiters.

Example 2: What I want already exists for some characters. There are the \lvertand \rvert delimiters. I would like to declare delimiting characters of this type for arbitrary characters. So, for my example 1 I would create the new commands \ldollar, \mdollar, and \rdollar which would produce a left, a middle, and a right $ sign delimiter, respectively.

  • you can just use \newcommand to define shortands for \mathopen{\$}, \mathbin{\$}, \mathclose{\$}` – David Carlisle Feb 5 '15 at 17:20
4

Use the commands \mathopen, \mathclose and \mathrel:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\ldollar}{\mathopen{\$}}
\newcommand{\rdollar}{\mathclose{\$}}
\newcommand{\mdollar}{\mathrel{\$}}

\begin{document}
$\log\ldollar a+b\rvert-\{a\mdollar b\}$
\end{document}

enter image description here

  • I'd have guessed \mathbin ? – David Carlisle Feb 5 '15 at 17:21
  • @DavidCarlisle Why \mathbin? A “middle delimiter” is surely a relation symbol like \mid. – egreg Feb 5 '15 at 17:23
  • I don't know what a$b means but if I had to guess, I'd guess it was semantically closer to a+b than a=b but who knows:-) – David Carlisle Feb 5 '15 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.