I want to create a macro for intersections that can switch between cap
and bigcap
depending on the situation. Here is what I came up with based on browsing other posts on the forum. Are there any hazards to this approach? Is there a better way?
\documentclass{article}
\makeatletter
\newcommand{\intersect}{\@ifnextchar_{\bigcap}{\cap}}
\makeatother
\begin{document}
\[
A \cap B
\]
\[
A \intersect B
\]
\[
\bigcap_{i=1}^{n} A_{i}
\]
\[
\intersect_{i=1}^{n} A_{i}
\]
\end{document}
mathpalette
\bigcap
inline and sometimes I want to use\cap
in displayed math. The real difference for me is whether the intersection is indexed, or just a binary operation.