WeBWorK Problems

Re: Adding Curly Braces to enclose a set of column vectors.

by Arnold Pizer -
Number of replies: 0
Davide responded on the old server. I copied his response here. I hope the formatting holds up. --Arnie

The reason your mbox command added extra text is because in HTML mode, mbox creates an HTML table and puts each entry in the mbox into a separate cell of the table. But since you have used an open math delimiter in one and a close math delimiter in another, the math mode includes the HTML tags that separate the cells, and these become part of the typeset equation.
Instead, you would want to concatenate the math strings to form a single string, as in:

\{ mbox( 'Let $$W$$ be the set: $$\left\lbrace'. display_matrix_mm([[-2], [3], [0]]),','.display_matrix_mm([[6], [-1], [5]]).'\right\rbrace$$.' ) \}

(using dots rather than commas).

Alternatively, you can use MathObjects to format the vectors rather than the more verbose display_matrix commands:

Context("Matrix");

$V1 = ColumnVector(-2,3,0);$V2 = ColumnVector(6,-1,5);

Context()->texStrings;
BEGIN_TEXT
Let $$W$$ be the set: $$\left\lbrace V1,V2\right\rbrace$$.
END_TEXT
Context()->normalStrings;

or if you don't want to make separate vector objects:

Context()->texStrings;
BEGIN_TEXT
Let $$W$$ be the set: $$\left\lbrace \{ColumnVector(-2,3,0)\},\{ColumnVector(6,-1,5)\}\right\rbrace$$.
END_TEXT
Context()->normalStrings;

Or you could use Matrix([[-2],[3],[0]]) in place of the ColumnVector call.

Hope that helps.

Davide