So I'm writing a latex document that has the following code in it
\begin{align*}
n! - k &= n! - \sum_{i=1}^{\left\lfloor\frac{n}{r}\right\rfloor}(-1)^{i+1}\binom{n}{r,\dots,n-ir} ((r-1)!)^i(n-ir)!\frac{1}{i!}\\[1em]
&= n! - \sum_{i=1}^{\left\lfloor\frac{n}{r}\right\rfloor}(-1)^{i+1} \frac{n!}{(r!)^i(n-ir)!}((r-1)!)^i(n-ir)!\frac{1}{i!}\\[1em]
&= n! - \sum_{i=1}^{\left\lfloor\frac{n}{r}\right\rfloor}(-1)^{i+1} \frac{n!}{r^i(n-ir)!}(n-ir)!\frac{1}{i!}\\[1em]
&= n! - \sum_{i=1}^{\left\lfloor\frac{n}{r}\right\rfloor}(-1)^{i+1}\frac{n!}{r^i*i!}\\[1em]
&= n!\left(1-\sum_{i=1}^{\left\lfloor\frac{n}{r}\right\rfloor}(-1)^{i+1}\frac{1}{r^i*i!}\right)\\[1em]
&= n!\left((-1)^0\frac{1}{r^0*0!}-\sum_{i=1}^{\left\lfloor\frac{n}{r}\right\rfloor}(-1)^{i+1}\frac{1}{r^i*i!}\right)\\[1em]
&= n!\sum_{i=0}^{\left\lfloor\frac{n}{r}\right\rfloor}(-1)^{i}\frac{1}{r^i*i!}
\end{align*}
I think you would agree with me that it looks disgusting. Generally because it seems to be filled with so many \left\lfloor <...> \right\rfloor strings.
Is it possible to define a command that writes \left and \right for me in the general case? I've read this post here Is it possible to write `\left(` `\right)` in one command? but it only covers the case when I want to use round brackets. What if I want to use square brackets, vertical bars or ceiling braces?



\biggland\biggrinstead of left and right? Also, I noticed that the floor braces don't span to the bottom of the fraction. This can be a problem because if the fraction was bigger, then the floor braces would not fit. I think this is on me because I provided a poor example of code. – Kookie Jun 01 '20 at 09:21\floor{n/r}, which is much less intrusive. I'd also recommend!\,when the factorial is followed by something that doesn't add space by itself. – egreg Jun 01 '20 at 09:23\left(and\right)are too big relative to what's optimal from a typographic point of view. For more on this topic see, e.g., this answer to the query Is it ever bad to use \left and \right?. [Shameless self-citation alert!] – Mico Jun 01 '20 at 09:24\frac. For the answer shown above, this may be achieved by defining\flnrnot as\newcommand\flnr{\floor{\frac{n}{r}}}but as\newcommand\flnr{\mathclap{\floor{n/r}}}. On adjusting the spacing if!(the factorial symbol) is followed by<something>(other than), right?): Note the use of\,in the first three rows to provide a visual breather between(n-ir)!and\frac{1}{i!}. I failed to mention this change explicitly in my write-up, though. :-( – Mico Jun 01 '20 at 09:37