Is it possible to shorten the use of \left and \right?
You could load the mathtools
package and use its \DeclarePairedDelimiter
macro to create a macro called, say, \floor
as follows:
\DeclarePairedDelimiter\floor\lfloor\rfloor
and replace all instances of \left\lfloor\frac{n}{r}\right\rfloor
with \floor{\frac{n}{r}}
. (For more information on the uses of \DeclarePairedDelimiter
, please see section 3.6., "Paired delimiters", in the user guide of the mathtools
package.)
And, since there are quite a few instances of \floor{\frac{n}{r}}
, it's useful to create a shorthand macro for them, say,
\newcommand\flnr{\floor{\frac{n}{r}}}
In addition, I would replace all instances of the multiplicative *
with \,
, i.e., thinspace. Also, use \biggl(
and \biggr)
for the large parentheses in rows 5 and 6, as the parentheses produced by \left(
and \right)
are too large from a purely typographic/aesthetic perspective.
\documentclass{article}
\usepackage{mathtools} % for '\DeclarePairedDelimiter' macro
\DeclarePairedDelimiter\floor\lfloor\rfloor
\newcommand\flnr{\floor{\frac{n}{r}}} % handy shortcut macro
\begin{document}
\begin{align*}
n!-k
&= n! - \sum_{i=1}^{\flnr} (-1)^{i+1} \binom{n}{r,\dots,n-ir} ((r-1)!)^i(n-ir)!\,\frac{1}{i!}\\[1ex]
&= n! - \sum_{i=1}^{\flnr} (-1)^{i+1} \frac{n!}{(r!)^i(n-ir)!}((r-1)!)^i(n-ir)!\,\frac{1}{i!}\\[1ex]
&= n! - \sum_{i=1}^{\flnr} (-1)^{i+1} \frac{n!}{r^i(n-ir)!}(n-ir)!\,\frac{1}{i!}\\[1ex]
&= n! - \sum_{i=1}^{\flnr} (-1)^{i+1}\frac{n!}{r^i\,i!}\\[1ex]
&= n!\biggl(1-\sum_{i=1}^{\flnr} (-1)^{i+1}\frac{1}{r^i\,i!}\biggr)\\[1ex]
&= n!\biggl((-1)^0\frac{1}{r^0\,0!}-\sum_{i=1}^{\flnr} (-1)^{i+1}\frac{1}{r^i\,i!}\biggr)\\[1ex]
&= n!\sum_{i=0}^{\flnr} (-1)^{i}\frac{1}{r^i\,i!}
\end{align*}
\end{document}
My proposal is almost the same as Mico's, but with some significant differences:
- use
n/r
instead of\frac{n}{r}
; - add
\,
when a factorial is followed by another object to be multiplied with (if that object doesn't produce space by itself, like in the last line); - two instances of nested parentheses are dealt with using
\bigl
and\bigr
; - no additional vertical space is necessary (due to the
n/r
in the upper bound of summations).
I endorse the proposal of avoiding *
for multiplication and substituting it with \,
in those denominators; it's not generally necessary, these cases seem to want it, mostly because of the same letter in the exponent and in the following symbol.
\documentclass{article}
\usepackage{amsmath,mathtools}
\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}
\begin{document}
\begin{align*}
n! - k
&= n! - \sum_{i=1}^{\floor{n/r}}(-1)^{i+1}\binom{n}{r,\dots,n-ir}
\bigl((r-1)!\bigr)^i(n-ir)!\,\frac{1}{i!}
\\
&= n! - \sum_{i=1}^{\floor{n/r}}(-1)^{i+1}
\frac{n!}{(r!)^i(n-ir)!}\bigl((r-1)!\bigr)^i(n-ir)!\,\frac{1}{i!}
\\
&= n! - \sum_{i=1}^{\floor{n/r}}(-1)^{i+1} \frac{n!}{r^i(n-ir)!}(n-ir)!\,\frac{1}{i!}
\\
&= n! - \sum_{i=1}^{\floor{n/r}}(-1)^{i+1}\frac{n!}{r^i\,i!}
\\
&= n!\,\biggl(1-\sum_{i=1}^{\floor{n/r}}(-1)^{i+1}\frac{1}{r^i\,i!}\biggr)
\\
&= n!\,\biggl((-1)^0\frac{1}{r^0\,0!}-
\sum_{i=1}^{\floor{n/r}}(-1)^{i+1}\frac{1}{r^i\,i!}\biggr)
\\
&= n!\sum_{i=0}^{\floor{n/r}}(-1)^{i}\frac{1}{r^i\,i!}
\end{align*}
\end{document}
You can use \qty
from physics
and \binom
from amsmath
, here's how they work:
\documentclass{article}
\usepackage{physics, amsmath}
\begin{document}
\begin{align*}
S &= \qty(\sum_{k=0}^n \binom{n}{k} x^k y^{n-k})\\
S &= \qty{\sum_{k=0}^n \binom{n}{k} x^k y^{n-k}}\\
S &= \qty[\sum_{k=0}^n \binom{n}{k} x^k y^{n-k}]
\end{align*}
\end{document}
The physics
package also helps with writing down matrices a little bit more easily with \mqty
. You just need to write \mqty
, then use the delimiters you want ()
, []
, or {}
, then, write whatever you like. Separate each column with &
and each row with \\
just like in a usual array.