class MTMathView : View
View subclass for rendering LaTeX Math.
MTMathView
accepts either a string in LaTeX or an MTMathList
to
display. Use
MTMathList
directly only if you are building it programmatically (e.g. using an
editor), otherwise using LaTeX is the preferable method.
The math display is centered vertically in the label. The default horizontal alignment is
is left. This can be changed by setting textAlignment
. The math is default
displayed in
Display* mode. This can be changed using labelMode
.
When created it uses MTFontManager.defaultFont
as its font. This can be changed
using
the font
parameter.
MTMathViewMode |
enum class MTMathViewMode : Enum<MTMathViewMode>
Different display styles supported by the |
MTTextAlignment |
enum class MTTextAlignment : Enum<MTTextAlignment>
If view width is not measured to fit equation size this will specify placement within the view. See textAlignment |
<init> |
MTMathView(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0)
View subclass for rendering LaTeX Math. |
displayErrorInline |
var displayErrorInline: Boolean
If true the default parse errors will be drawn as text instead of math equation. Default value is true |
errorFontSize |
val errorFontSize: Float
When parsing errors are drawn this will control the size of the resulting error text and therefore view measured size. In device pixels |
font |
var font: MTFont?
Font used to draw the equation. See MTFontManager |
fontSize |
var fontSize: Float
This is in device pixels. Default value is see KDefaultFontSize |
labelMode |
var labelMode: MTMathViewMode
Should display or text mode be used. |
lastError |
val lastError: MTParseError
Holds the error status from the last parse of the LaTeX string. The errorcode of this can be checked to determine if the string was well formatted. |
latex |
var latex: String
The LaTeX Math string to display in the view. |
mathList |
var mathList: MTMathList?
Not normally used. Only if you are building a mathlist in code. Standard usage is setting a String in latex property. |
textAlignment |
var textAlignment: MTTextAlignment
Alignment within the view |
textColor |
var textColor: Int
Color of the equation if not overridden with local color changes by TeX commands |
onDraw |
fun onDraw(canvas: Canvas): Unit
|
onMeasure |
fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit
|
convertDpToPixel |
fun convertDpToPixel(dp: Float): Float
Utility function to convert device independent pixel values to device pixels |