# Defining macros based on environment

Right now, I have two macros, \intersects and \union, that simply point back to \cap and \cup respectively. Unfortunately, to have nice typesetting in display-like environments, I need to use \bigcap and \bigcup, right? Is there any way I can define \union one way for standard use (no particular environment) and another way for anything else?

-
Not really \cup is designed for infix use (like +) \bigcup is already defined to have large/small variants and be used as a prefix operator like \sum so they have different usage not directly related to inline/display. –  David Carlisle Sep 11 '12 at 16:32
David is right, but if you really want something like that, \mathpalette should be useful (AFAIR): \def\union{\mathpalette{\bigcup}{\cup}{\cup}{\cup}}. –  mbork Sep 11 '12 at 16:50
@mbork But nobody would want that. –  Stephan Lehmke Sep 11 '12 at 18:04
I suppose that's fair. So maybe just \def something like \iunion or \iintersects for the iterative variants (\bigcup/\bigcap)? –  Sean Allred Sep 11 '12 at 20:17
@vermiculus: True to your question about conditional typesetting: You can test for the current environment name (stored in \@currenvir). However, this requires you to use \begin{<env>}...\end{<env>}, otherwise $...$ might cause problems. The last example can be alleviated when using amsmath since it equates the macro to the environment. –  Werner Sep 12 '12 at 1:41

Since no other answer has been proffered I'll extend my comment as an answer:

\cup is designed for infix use (like +) \bigcup is already defined to have large/small variants and be used as a prefix operator like \sum so they have different usage not directly related to inline/display.

Examples of usage:

\documentclass{article}

\textwidth.2\textwidth
\parindent0pt
\parskip\baselineskip
\begin{document}

inline cup:\\
$a \cup b \cup c$

display cup
$a \cup b \cup c$

inline bigcup\\
$\bigcup_{i=0}^3a_i$

display bigcup
$\bigcup_{i=0}^3a_i$

\end{document}

-