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:
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.
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.
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:
\documentclass{article}
\usepackage{amssymb}
\usepackage{graphics}
\makeatletter
\newcommand*{\scaleddelims}[3]{%
\ensuremath{%
\mathpalette{\@scaleddelims{#1}{#2}}{#3}%
}%
}
\newcommand*{\@scaleddelims}[4]{%
% #1: left delimiter
% #2: right delimiter
% #3: \displaystyle, \textstyle, ...
% #4: inner formula
\begingroup
#3%
\sbox0{$\m@th#3\vphantom{A}#4$}%
\setbox2\vbox{\hbox{$\m@th#3#1$}\kern\z@}%
\setbox4\vbox{\hbox{$\m@th#3#2$}\kern\z@}%
\setbox6\hbox{$#3\vcenter{}$}%
\ifx\downharpoonleft#1\relax
\let\DelimLeft=L%
\else\ifx\upharpoonleft#1%
\let\DelimLeft=L%
\else\ifx\downharpoonright#1%
\let\DelimLeft=R%
\else\ifx\upharpoonright#1%
\let\DelimLeft=R%
\fi\fi\fi\fi
\ifx\downharpoonleft#2\relax
\let\DelimRight=L%
\else\ifx\upharpoonleft#2\relax
\let\DelimRight=L%
\else\ifx\downharpoonright#2\relax
\let\DelimRight=R%
\else\ifx\upharpoonright#2\relax
\let\DelimRight=R%
\fi\fi\fi\fi
\ifx\DelimLeft L%
\wd2=.6\wd2
\fi
\ifx\DelimRight L%
\wd4=.6\wd4
\fi
\ifx\DelimLeft R%
\sbox2{\kern-.4\wd2\box2}%
\fi
\ifx\DelimRight R%
\sbox4{\kern-.4\wd4\box4}%
\fi
\dimen0=\ht0 %
\advance\dimen0 by -\ht6 %
\dimen2=\dp0 %
\advance\dimen2 by \ht6 %
\ifdim\dimen2>\dimen0 %
\dimen0=\dimen2 %
\else
\dimen0=\dimen0 %
\fi
\dimen2=\ht6 %
\advance\dimen2 by -\dimen0 %
\dimen0=2\dimen0 %
\def\DelimCorr{%
\mskip.5\thinmuskip
\nonscript\mskip.5\thinmuskip
}%
\mathopen{%
\ifx\DelimLeft R\DelimCorr\fi
\raisebox{\dimen2}{\resizebox{!}{\dimen0}{\box2}}%
\ifx\DelimLeft L\DelimCorr\fi
}%
\begingroup
#3#4%
\endgroup
\mathclose{%
\ifx\DelimRight R\DelimCorr\fi
\raisebox{\dimen2}{\resizebox{!}{\dimen0}{\box4}}%
\ifx\DelimRight L\DelimCorr\fi
}%
\endgroup
}
\makeatother
\begin{document}
$ x + \scaleddelims{\downharpoonleft}{\downharpoonright}{\frac{4x}{x^2+3}}
+ \scaleddelims\downharpoonleft\downharpoonright{\frac\cdot{\frac XY}}
+ \scaleddelims\downharpoonleft\downharpoonright{\frac{\frac XY}\cdot}
$
\bigskip
$ 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
$
\bigskip
$ \mathopen{\downharpoonleft} x \mathclose{\downharpoonright} =
\scaleddelims{\downharpoonleft}{\downharpoonright}{x} =
\rfloor x \lfloor
\qquad
\scaleddelims\downharpoonleft\downharpoonright{}
$
\bigskip
$ y \scaleddelims\downharpoonright\downharpoonleft{\frac ab} z
^{\scaleddelims\downharpoonleft\downharpoonright{c}}
$
\end{document}

however other things might come.
– IARI Aug 14 '12 at 07:25tikz? The path decorations allow for all kind of "arrow-like" symbols in various lengths. – Jonathan Aug 14 '12 at 18:41\leftand\right(which is what I want). – IARI Aug 14 '12 at 21:04