This shows you the differences between two versions of the page.
documentation:ref:outputformat [2015/11/21 12:33] |
documentation:ref:outputformat [2015/11/21 12:33] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== OutputFormat ====== | ||
+ | ---- | ||
+ | |||
+ | ====Description==== | ||
+ | ''OutputFormat'' is a enum that defines different formats of string representation of expressions in Redberry. | ||
+ | |||
+ | There are several available output formats. In order to specify a particular one one can do: | ||
+ | <sxh groovy; gutter: false> | ||
+ | import cc.redberry.groovy.Redberry | ||
+ | import cc.redberry.core.context.OutputFormat | ||
+ | |||
+ | use(Redberry){ | ||
+ | def expr = 'a * F^{A}_{A m n} + g_mn'.t | ||
+ | println expr.toString(OutputFormat.Maple) | ||
+ | } | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > a * F[m, n, ~A, A] + g_[m, n] | ||
+ | </sxh> | ||
+ | The above result can be directly pasted to Maple system. | ||
+ | |||
+ | The available output formats are: | ||
+ | ''Redberry'', | ||
+ | ''Cadabra'', | ||
+ | ''LaTeX'', | ||
+ | ''WolframMathematica'', | ||
+ | ''Maple'', | ||
+ | ''UTF8'', | ||
+ | ''SimpleRedberry''. The last one can be used to print matrix objects in a convenient and human-readable format. | ||
+ | |||
+ | |||
+ | One can set the default output format in the following way: | ||
+ | <sxh groovy; gutter: false> | ||
+ | //set Cadabra output by default | ||
+ | CC.defaultOutputFormat = OutputFormat.Cadabra | ||
+ | </sxh> | ||
+ | |||
+ | ====See also==== | ||
+ | * Related guides: [[documentation:guide:inputting_and_printing_mathematical_expressions]], [[documentation:guide:setting_up_matrix_objects]] | ||
+ | * JavaDocs: [[http://api.redberry.cc/redberry/1.1.9/java-api//cc/redberry/core/context/OutputFormat.html| OutputFormat]] | ||
+ | * Source code: [[https://bitbucket.org/redberry/redberry/src/tip/core/src/main/java/cc/redberry/core/context/OutputFormat.java|OutputFormat.java]] | ||