I would like to create "square-curly bracket" delimiters, somehow looking as in this question. I came up with the code below, which produces some good results, but has also some inconvenients. For instance we get these examples:
You can see that the fraction bar is not really centered (because of the exponent 'j'), and the formatting under the summation symbols is too big.
My question is:
How would you proceed to have nice-looking "square-curly" brackets?
MWE:
\documentclass{article}
\usepackage{tikz, mathtools, titletoc}
\DeclareRobustCommand{\fp}[1]{%
\let\mybox\relax%
\newsavebox\mybox%
\sbox{\mybox}{$#1$}%
\def\WIDTH{\the\dimexpr\wd\mybox + 6pt \relax}%
\def\HEIGHT{\the\dimexpr\ht\mybox * 10 / 20 + \dp\mybox * 10/20 + 2pt\relax}%
\def\SHIFT{2pt}%
\begin{tikzpicture}[baseline = -0.57ex]
\draw [line width=0.6] (\SHIFT, \HEIGHT) -- (0, \HEIGHT) -- (0, 1.0pt) -- (-1.5pt, 0) -- (0, -1.0pt) -- (0, -\HEIGHT) -- (\SHIFT, -\HEIGHT);%
\node[anchor = west] at (-0.01, 0) {\copy\mybox};%
\draw [line width=0.6] (-\SHIFT + \WIDTH, \HEIGHT) -- (0 + \WIDTH, \HEIGHT) -- (0 + \WIDTH, 1.0pt) -- (1.5pt + \WIDTH, 0) -- (0 + \WIDTH, -1.0pt) -- (0 + \WIDTH, -\HEIGHT) -- (-\SHIFT + \WIDTH, -\HEIGHT);%
\end{tikzpicture}%
}
\begin{document}
$\fp{x} \qquad \fp{ \frac{x a}{d} } = \left\{ \frac{x a}{d} \right\} \leq \frac{1}{2}$
\[ \fp{ -x } = \fp{ \dfrac{a x}{d} } = \fp{ \frac{x}{2} } =
\fp{ \dfrac{- t \cdot a^j }{ R } } = \fp{ \dfrac{- t a_j }{ R } } \]
\[ \sum_{ \fp{r/m} \in S } r = \sum_{ \fp{ \frac{r}{m} } \in S } r. \]
\end{document}
\global\let\mybox\relax
seems to be better? But anyway it doesn't solve the formatting issues.