format a magma as text for inclusion in a document - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Algebra : Magma : Magma/Format

Magma[Format] - format a magma as text for inclusion in a document

Calling Sequence

Format( m )

Format( m, options )

Parameters

m

-

a magma to format

options

-

zero or more options of the form format = fmt or labels = lbls.

Description

• 

The Format command formats a magma (as an operation table) to a string in any one of several supported formats.  This is meant to be a tool for including small magmas in documents such as papers, e-mail or web pages.

• 

The formatted magma is returned as a string of text formatted using the selected format. You can use the printf command (with the %s conversion specifier) to print the string.  Alternatively, the returned text may be written to a file.

Examples

withMagma:

Create a small magma  with five members to be formatted.

m:=RandomMagma5

m:=4212545223221314112453235

(1)

The default is to format the magma as plain text.

printf%s ,Formatm

 4 2 1 2 5
 4 5 2 2 3
 2 2 1 3 1
 4 1 1 2 4
 5 3 2 3 5

printf%s ,Formatm,'format'=text

 4 2 1 2 5
 4 5 2 2 3
 2 2 1 3 1
 4 1 1 2 4
 5 3 2 3 5

Use LaTeX to include the formatted magma in a paper or book.

printf%s ,Formatm,'format'='latex'

\begin{smallmatrix}4&2&1&2&5\\ 4&5&2&2&3\\ 2&2&1&3&1\\ 4&1&1&2&4\\ 5&3&2&3&5
\end{smallmatrix}

Use HTML, MathML or MediaWiki for inclusion in a web page.

printf%s ,Formatm,'format'='html'

<table cols='5'>
<tr><td>4</td><td>2</td><td>1</td><td>2</td><td>5</td></tr>
<tr><td>4</td><td>5</td><td>2</td><td>2</td><td>3</td></tr>
<tr><td>2</td><td>2</td><td>1</td><td>3</td><td>1</td></tr>
<tr><td>4</td><td>1</td><td>1</td><td>2</td><td>4</td></tr>
<tr><td>5</td><td>3</td><td>2</td><td>3</td><td>5</td></tr>
</table>

printf%s &comma;Formatm&comma;&apos;format&apos;&equals;&apos;mathml&apos;

<matrix><matrixrow><mn>4</mn><mn>2</mn><mn>1</mn><mn>2</mn><mn>5</mn></matrixrow><matrixrow><mn>4</mn><mn>5</mn><mn>2</mn><mn>2</mn><mn>3</mn></matrixrow><matrixrow><mn>2</mn><mn>2</mn><mn>1</mn><mn>3</mn><mn>1</mn></matrixrow><matrixrow><mn>4</mn><mn>1</mn><mn>1</mn><mn>2</mn><mn>4</mn></matrixrow><matrixrow><mn>5</mn><mn>3</mn><mn>2</mn><mn>3</mn><mn>5</mn></matrixrow></matrix>

printf%s &comma;Formatm&comma;&apos;format&apos;&equals;&apos;wiki&apos;

{| border="1"
|-
|4 || 2 || 1 || 2 || 5
|-
|4 || 5 || 2 || 2 || 3
|-
|2 || 2 || 1 || 3 || 1
|-
|4 || 1 || 1 || 2 || 4
|-
|5 || 3 || 2 || 3 || 5
|}

Display the magma using letters instead of small integers for its elements.

printf%s &comma;Formatm&comma;&apos;labels&apos;&equals;abcde

 d b a b e
 d e b b c
 b b a c a
 d a a b d
 e c b c e

withStringTools&colon;

printf%s &comma;Formatm&comma;&apos;format&apos;&equals;latex&comma;&apos;labels&apos;&equals;mapFence&comma;Explodeabcde&comma;$&comma;$

\begin{smallmatrix}$d$&$b$&$a$&$b$&$e$\\$d$&$e$&$b$&$b$&$c$\\$b$&$b$&$a$&$c$&$a$\\$d$&$a$&$a$&$b$&$d$\\$e$&$c$&$b$&$c$&$e$
\end{smallmatrix}

See Also

Magma RandomMagma


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam