
com.github.tomtung.latex2unicode.helper.Style.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of latex2unicode_2.13 Show documentation
Show all versions of latex2unicode_2.13 Show documentation
Convert LaTeX markup to Unicode.
The newest version!
package com.github.tomtung.latex2unicode.helper
object Style {
val alias = Map(
"\\bf" -> "\\textbf",
"\\cal" -> "\\textcal",
"\\it" -> "\\textit",
"\\tt" -> "\\texttt"
)
val names: Set[String] = alias.keySet
def translate(command: String, text: String): String = {
if (!names.contains(command)) {
throw new IllegalArgumentException(s"Unknown command: $command")
}
Unary.translate(alias(command), text)
}
}