LatexRenderer

com.phasmidsoftware.number.algebra.util.LatexRenderer
See theLatexRenderer companion trait
object LatexRenderer

Companion object for LatexRenderer providing utility methods and syntax extensions.

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

final implicit class LatexRendererOps[A](val value: A) extends AnyVal

Syntax extension that adds toLatex method to any type with a LatexRenderer instance.

Syntax extension that adds toLatex method to any type with a LatexRenderer instance.

Example usage:

import LatexRenderer._
val solution = QuadraticSolution(...)
val latex = solution.toLatex

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def apply[A](implicit renderer: LatexRenderer[A]): LatexRenderer[A]

Summoner method for accessing typeclass instances.

Summoner method for accessing typeclass instances.

Type parameters

A

the type for which to retrieve the renderer

Attributes

Returns

the LatexRenderer instance for type A

def frac(numerator: String, denominator: String): String

Helper method to create a fraction.

Helper method to create a fraction.

Value parameters

denominator

the denominator

numerator

the numerator

Attributes

Returns

LaTeX fraction notation

def instance[A](f: A => String): LatexRenderer[A]

Constructor for creating LatexRenderer instances from functions.

Constructor for creating LatexRenderer instances from functions.

Type parameters

A

the type to render

Value parameters

f

the function that converts A to LaTeX

Attributes

Returns

a new LatexRenderer instance

def mathMode(content: String, inline: Boolean = ...): String

Helper method to wrap content in LaTeX math mode delimiters.

Helper method to wrap content in LaTeX math mode delimiters.

Value parameters

content

the LaTeX expression

inline

if true, uses inline math mode ($...$), otherwise display mode ($$...$$)

Attributes

Returns

the content wrapped in appropriate delimiters

def nthRoot(n: Int, content: String): String

Helper method to create an nth root.

Helper method to create an nth root.

Value parameters

content

the radicand

n

the root degree

Attributes

Returns

LaTeX nth root notation

def sign(isPositive: Boolean): String

Helper method to format a sign (+ or -) with appropriate spacing.

Helper method to format a sign (+ or -) with appropriate spacing.

Value parameters

isPositive

if true, returns "+", otherwise "-"

Attributes

Returns

the formatted sign

def sqrt(content: String): String

Helper method to create a square root.

Helper method to create a square root.

Value parameters

content

the radicand

Attributes

Returns

LaTeX square root notation

Implicits

Implicits

final implicit def LatexRendererOps[A](value: A): LatexRendererOps[A]

Syntax extension that adds toLatex method to any type with a LatexRenderer instance.

Syntax extension that adds toLatex method to any type with a LatexRenderer instance.

Example usage:

import LatexRenderer._
val solution = QuadraticSolution(...)
val latex = solution.toLatex

Attributes