LaTeXReportRenderer

A ksl.utilities.io.report.visitor.ReportVisitor that renders a ReportNode tree to a LaTeX source file (.tex).

Extends AbstractReportVisitor and overrides only the nodes it handles; unrecognised nodes are silently skipped (no-op from the base class).

Preamble (emitted in enterDocument):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\geometry{margin=1in}
\title{…}
\date{\today}
\begin{document}
\maketitle

Node rendering:

LaTeX escaping: all user-supplied strings are passed through escapeLaTeX which escapes the ten special LaTeX characters (\ { } $ & # ^ _ % ~).

All mutable state uses the my prefix per KSL coding conventions.

Parameters

ctx

the render context supplying output paths and formatting preferences

Constructors

Link copied to clipboard
constructor(ctx: RenderContext = RenderContext())

Functions

Link copied to clipboard
open override fun enterDocument(node: ReportNode.Document)
Link copied to clipboard
open override fun enterSection(node: ReportNode.Section)
Link copied to clipboard
open override fun exitDocument(node: ReportNode.Document)
Link copied to clipboard
open override fun exitSection(node: ReportNode.Section)
Link copied to clipboard
fun result(): String

Returns the accumulated LaTeX source as a String.

Link copied to clipboard
open override fun visit(node: ReportNode.DataTable)
open override fun visit(node: ReportNode.Heading)
open override fun visit(node: ReportNode.PageBreak)
open override fun visit(node: ReportNode.Paragraph)
open override fun visit(node: ReportNode.PlotNode)
open override fun visit(node: ReportNode.RawText)
open override fun visit(node: ReportNode.StatPropertyTable)
open override fun visit(node: ReportNode.StatTable)
open override fun visit(node: ReportNode.WeightedStatTable)
Link copied to clipboard

Writes the accumulated LaTeX source to the given PrintWriter.

fun writeTo(path: Path): File

Writes the accumulated LaTeX source to a file at path and returns a File reference.