I would like to have a variable sized delimiter version of the ams symbols \downharpoonleft, \downharpoonright and \upharpoonleft, \upharpoonright respectively, such that they work with \left and \right. Is there any package that provides something like that?

Excerpt from symbols-a4.pdf

  • if you can give sample contexts of what you'd like to have delimited, i may be able to concoct something. – barbara beeton Aug 13 '12 at 20:06
  • 1. simple variable names and 2. matrices, however other things might come. – IARI Aug 14 '12 at 7:25
  • 1
    Have you tried using tikz? The path decorations allow for all kind of "arrow-like" symbols in various lengths. – Jonathan Aug 14 '12 at 18:41
  • I use tikz a lot, however, I was hoping that there is some predefined way to do it. I could achieve what I want with tikz directly, but I would not know, how to make some generic variable-sized delimiters that work with \left and \right (which is what I want). – IARI Aug 14 '12 at 21:04

Recipe for supporting \left and \right

\left and \right are supported by properties of TFM files. The symbol can be given in different sizes and build a list of characters with ascending sizes in the TFM file. The last entry in the list is an extensible character. The latter is shortly explained the documentation of tftopl, § 14:

14. Extensible characters are specified by an extensible_recipe, which consists of four bytes called top, mid, bot, and rep (in this order). These bytes are the character codes of individual pieces used to build up a large symbol. If top, mid, or bot are zero, they are not present in the built-up result. For example, an extensible vertical line is like an extensible bracket, except that the top and bottom pieces are missing.

The recipe for creating support for \left and \right:

  1. Some real font (Type 1, …) is necessary that contains the characters and especially the pieces that are needed to build an extensible character. The programs t1disasm and t1asm might help in this task by learning from existing fonts.

  2. The TFM file is created with the right data structures that references the font of the previous step. The programs tftopl and pltotf help in converting TFM files to a readable format and converting back. The documentation of tftopl also contains the description of the TFM file format with its data structures.

  3. Definition of the new math font and its symbols in TeX/LaTeX.

This recipe is intended for the more experienced who has enough time (hours if not days).

Poor man's solution via \resizebox

In the following I have hacked a example file that uses \resizebox of package graphics (or graphicx). The disadvantage is that also the line width is proportionately scaled, but this is too much for large sizes.

The hack tries to take into account:

  • Delimiters are centered at the math axis.
  • Support for the automatically resizing in subscripts, … (via \mathpalette).
  • The bounding box for the harpoons have horizontal white space of the other side of the hook. For larger sizes it is scaled too much. Therefore the white space is first stripped and then reinserted as thin space for non-script styles and as half thin space in script styles.

The example file:


  % #1: left delimiter
  % #2: right delimiter
  % #3: \displaystyle, \textstyle, ...
  % #4: inner formula
    \ifx\DelimLeft L%
    \ifx\DelimRight L%
    \ifx\DelimLeft R%
    \ifx\DelimRight R%
    \dimen0=\ht0 %
    \advance\dimen0 by -\ht6 %
    \dimen2=\dp0 %
    \advance\dimen2 by \ht6 %
    \ifdim\dimen2>\dimen0 %  
      \dimen0=\dimen2 %
      \dimen0=\dimen0 %
    \dimen2=\ht6 %
    \advance\dimen2 by -\dimen0 %
    \dimen0=2\dimen0 %
      \ifx\DelimLeft R\DelimCorr\fi
      \ifx\DelimLeft L\DelimCorr\fi
      \ifx\DelimRight R\DelimCorr\fi
      \ifx\DelimRight L\DelimCorr\fi


$ x + \scaleddelims{\downharpoonleft}{\downharpoonright}{\frac{4x}{x^2+3}}
  + \scaleddelims\downharpoonleft\downharpoonright{\frac\cdot{\frac XY}}  
  + \scaleddelims\downharpoonleft\downharpoonright{\frac{\frac XY}\cdot}  

$ x + \left\rfloor \frac{4x}{x^2+3} \right\lfloor
  + \left\rfloor \frac\cdot{\frac XY} \right\lfloor
  + \left\rfloor \frac{\frac XY}\cdot \right\lfloor

$ \mathopen{\downharpoonleft} x \mathclose{\downharpoonright} =
  \scaleddelims{\downharpoonleft}{\downharpoonright}{x} =
  \rfloor x \lfloor

$ y \scaleddelims\downharpoonright\downharpoonleft{\frac ab} z


Result of example file

  • Thanks, however I'am new to this and haven't done any of it before. I'll try reading into it, any tutorial recommendation? – IARI Aug 15 '12 at 9:34
  • I would like to use this to define a restriction operator, like \newcommand{\rest}[2]\scaleddelims{\upharpoonright}{\vphantom{.}}{\vphantom{#1}#2}, but LaTeX tells me that either I'm missing a dollar sign or a \begin{document}. What should I do? – jdc Jul 7 '14 at 21:56
  • 1
    @jdc: A formal correct definition would be \newcommand{\rest}[2]{\scaleddelims{\upharpoonright}{\vphantom{.}}{\vphantom{#1}#2}}. But I have no idea, what \rest is supposed to do. – Heiko Oberdiek Jul 7 '14 at 22:20
  • Wow, that was a dumb error. I somehow couldn't figure out the braces were missing. Also, I realize I wanted to put a #1 before \scaleddelims. The goal was to denote the restriction of a function to a subdomain with a properly tall restriction sign. Thanks! – jdc Jul 8 '14 at 2:42
  • Another question, since I've got your attention: you seem to be saying \upharpoonright is already extensible, but I seem to get errors when putting, e.g., \big or \left before it. What else should I be doing? – jdc Jul 8 '14 at 2:47

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.