Difference between revisions of "Display matrix"

From WeBWorK_wiki
Jump to navigation Jump to search
m (DisplayMatrix moved to Display matrix: consistent naming)
m (The latex formatting \[ and \] tags made the "display_matrix" commands look like latex for some reason)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
  +
{{DISPLAYTITLE:display_matrix}}
 
===display_matrix===
 
===display_matrix===
   
Line 17: Line 18:
 
'''Examples'''
 
'''Examples'''
   
<blockquote> Usually used in BEGIN_TEXT/END_TEXT blocks as<blockquote> \[ \{ display_matrix($A) \} \]<br /> \[ \{ display_matrix([ [ 1, 3], [4, 6] ]) \} \]<br /> \[ \{ display_matrix([ [ ans_rule(), ans_rule()], [ans_rule(), ans_rule()] ]) \} \]</blockquote></blockquote>
+
<blockquote> Usually used in BEGIN_TEXT/END_TEXT blocks as<blockquote> \{ display_matrix($A) \} <br /> \{ display_matrix([ [ 1, 3], [4, 6] ]) \} <br /> \{ display_matrix([ [ ans_rule(), ans_rule()], [ans_rule(), ans_rule()] ]) \} </blockquote></blockquote>
   
 
'''Notes'''
 
'''Notes'''

Latest revision as of 09:13, 25 March 2013

display_matrix

Description

Provides a rectangular display of a matrix object by producing the appropriate TeX code for displaying the contents.

Syntax

display_matrix($matrix_object)

Params

$matrix_object is a matrix object. See Matrix.pm and "RealMatrix.pm"

Returns

String which represents the matrix in TeX format used in math display mode.

Examples

Usually used in BEGIN_TEXT/END_TEXT blocks as

\{ display_matrix($A) \}
\{ display_matrix([ [ 1, 3], [4, 6] ]) \}
\{ display_matrix([ [ ans_rule(), ans_rule()], [ans_rule(), ans_rule()] ]) \}

Notes

Note that the order of answers inserted in the last example is across each row first. This is usually what is expected, but you can use "NAME_ANS_RULE" if more control is desired.
See Matrix.pm for matrix methods which specify display.