Suppose E1 is an expression in LaTeX, where one entry is x. Suppose E2 is another expression. How do you replace x by E2?
Can I wrap E2 in a box of certain size and have LaTeX replace x with that box without asking LaTeX to look inside the box and try to rearrange its internal structure?
For example: How do you replace an element of a given 3*3 matrix with a particular 2*2 matrix?
The answers so far are very interesting in themselves but none worked for me. So let me re-state. Suppose in an environment I can put a literal $x$ without any problem but I cannot put a matrix or a multi-line equation in the same spot, as it conflicts with various commands etc. How can I make a matrix act like an $x$ to the rest of program? As if I have to build the matrix somewhere else, put it in a box, and sell it to LateX as a single item as if it has no line return.

minipageenvironment? – krlmlr Feb 4 '12 at 14:52