Title: | TeX-to-HTML/MathML Translators TtH/TtM |
---|---|
Description: | C source code and R wrappers for the tth/ttm TeX-to-HTML/MathML translators. |
Authors: | Ian H. Hutchinson [aut] (author of tth/ttm C sources), Friedrich Leisch [aut] (<https://orcid.org/0000-0001-7278-1983>, author of R wrappers to tth/ttm, maintainer 2012-2024), Achim Zeileis [aut, cre] (<https://orcid.org/0000-0003-0918-3766>, author of R wrappers to tth/ttm) |
Maintainer: | Achim Zeileis <[email protected]> |
License: | GPL-2 |
Version: | 4.16-0 |
Built: | 2024-11-03 06:39:13 UTC |
Source: | CRAN |
tth/ttm are command line utilities written by Hutchinson (2017) for converting (La)TeX to HTML or HTML+MathML, respectively.
The R package tth ships the C sources for convenient compilation and installation on all platforms. It also provides wrappers in R to process R character vectors with the command line tools directly from the R prompt. A detailed manual for tth/ttm is available online at http://silas.psfc.mit.edu/tth/.
Hutchinson IH (2022). TtH: The TeX to HTML Translator, Version 4.16. http://silas.psfc.mit.edu/tth/
Convert TeX or LaTeX markup to HTML or HTML+MathML. Works for snippets as well as complete documents.
tth(x, ..., fixup = TRUE, Sweave = TRUE, mode = NULL) ttm(x, ..., fixup = TRUE, Sweave = TRUE, mode = NULL) tth.control(a = FALSE, c = FALSE, d = FALSE, e = 2, f = NULL, g = FALSE, i = FALSE, j = NULL, L = TRUE, n = NULL, p = NULL, r = TRUE, t = FALSE, u = FALSE, w = NULL, y = 2, xmakeindxcmd = NULL, v = FALSE)
tth(x, ..., fixup = TRUE, Sweave = TRUE, mode = NULL) ttm(x, ..., fixup = TRUE, Sweave = TRUE, mode = NULL) tth.control(a = FALSE, c = FALSE, d = FALSE, e = 2, f = NULL, g = FALSE, i = FALSE, j = NULL, L = TRUE, n = NULL, p = NULL, r = TRUE, t = FALSE, u = FALSE, w = NULL, y = 2, xmakeindxcmd = NULL, v = FALSE)
x |
character vector of (La)TeX code. |
fixup |
logical. Should the resulting code be fixed up by deleting blank or empty lines and by replacing certain math symbols (such as not lower/greater etc.)? |
Sweave |
logical. Should the Sweave code environments Sinput/Soutput be
replaced by verabtim (and Schunk deleted) prior to conversion with |
mode |
character. If this is set to |
... |
arguments passed to |
a |
logical. Attempt automatic picture environment conversion
using |
c |
logical. Prefix header |
d |
logical. Disable definitions with delimited arguments? Default enable. |
e |
numeric specifying epsfbox handling: |
f |
numeric specifying limit for built-up fraction nesting in display
equations to |
g |
logical. Remove (instead of guessing intent of) font commands. Default guess font/size. |
i |
logical. Use italic font for equations (like TeX)? Default roman.
For |
j |
numeric specifying index page length. Default is 20 lines. |
L |
logical or character. If logical: Should LaTeX commands (e.g., frac) be enabled without a docmentclass line? If character: The base file (no extension) for LaTeX auxiliary input. |
n |
numeric HTML title format control: |
p |
character specifying additional directories (paths) to search for input files. |
r |
logical. Raw HTML output (omit header and tail) for inclusion in other files? |
t |
logical. Display built-up items in textstyle equations? Default is inline.
For |
u |
logical. Use unicode character encoding? Default is ISO-8859-1 (latin1). |
w |
numeric specifying HTML writing style. Default is no head/body tags,
|
y |
numeric specifying equation style: |
xmakeindxcmd |
character specifying command for making index. Default is makeindex. |
v |
logical or numeric. Give verbose commentary? Verbosity level can also be
|
tth
and ttm
are simple R wrapper functions,
calling command line tools of the same name which either need to be
provided by the R package tth or be installed on the system (and
available in the search path). The command line tools have been
written by Hutchinson (2017) and a detailed manual is available online
at http://silas.psfc.mit.edu/tth/.
By default, the results of tth
and ttm
are processed further
to accomodate the Sweave
environments and fixup
certain
math symbols. Furthermore, optionally a particular mode
for character
entity references (mathematical symbols, greek letters, and other special characters)
can be enforced. For example, the greek small letter mu
can be represented in "named"
mode (&mgr;
or μ
),
in "hex"
mode (μ
) or "dec"
model (μ
).
Plain tth
employs "dec"
mode while plain ttm
employs
"named"
mode. But setting mode = "hex"
would convert all
character entity references to hex mode etc.
See https://www.w3.org/TR/xml-entity-names/bycodes.html for the list of
character entity references employed and
https://html.spec.whatwg.org/multipage/named-characters.html
for a somewhat nicer display.
tth
/ttm
return a character vector with HTML
code. tth.control
returns a character vector with collapsed
(non-default) control arguments.
Hutchinson IH (2022). TtH: The TeX to HTML Translator, Version 4.16. http://silas.psfc.mit.edu/tth/
tex <- c("This is \\textbf{bold} and this \\textit{italic}.", "Points on the unit circle: $x^2 + y^2 = 1$.") tth(tex) ttm(tex) h0 <- "$H_0: \\mu_0 = 0$" tth(h0) tth(h0, mode = "hex") tth(h0, mode = "named") ttm(h0) ttm(h0, mode = "hex") ttm(h0, mode = "dec")
tex <- c("This is \\textbf{bold} and this \\textit{italic}.", "Points on the unit circle: $x^2 + y^2 = 1$.") tth(tex) ttm(tex) h0 <- "$H_0: \\mu_0 = 0$" tth(h0) tth(h0, mode = "hex") tth(h0, mode = "named") ttm(h0) ttm(h0, mode = "hex") ttm(h0, mode = "dec")