Easily change behavior of \DeclarePairedDelimiter
I continue to believe that one should use \left
and \right
where really needed and any sort of automatism for this is bad.
However, here's a simple and working implementation of your macro, that I call \xDeclarePairedDelimiter
\documentclass{scrartcl}
\usepackage{mleftright,xparse}
\NewDocumentCommand\xDeclarePairedDelimiter{mmm}
{%
\NewDocumentCommand#1{som}{%
\IfNoValueTF{##2}
{\IfBooleanTF{##1}{#2##3#3}{\mleft#2##3\mright#3}}
{\mathopen{##2#2}##3\mathclose{##2#3}}%
}%
}
\xDeclarePairedDelimiter{\set}{\lbrace}{\rbrace}
\begin{document}
\begin{align*}
&\liminf \set{\sum}\\
&\liminf \set*{\sum}\\
&\liminf \set[\big]{\sum}\\
&\liminf \set[\Big]{\sum}
\end{align*}
\end{document}