Documentation
¶
Overview ¶
Package beamer registers a `beamer` rendering target for the component catalog and projects its manifests into a compilable Beamer document.
The kinds implemented here are the vocabulary specified in docs/plato-integration.md.
Index ¶
Constants ¶
const ChildrenMarker = "%%autopdf:children%%"
ChildrenMarker is where the projector splices a container's rendered children. A container renderer emits its opening and closing LaTeX around this marker; a fragment without it receives its children appended.
const DefaultPreamble = `` /* 162-byte string literal not displayed */
DefaultPreamble is the style setup the bundled renderers assume. Options.Preamble replaces it.
const Target = "beamer"
Target is the dispatch target these definitions register under.
Variables ¶
var ( // MarkCommands name the LaTeX command wrapping a span that carries the // mark. Marks apply in sorted order. MarkCommands = map[string]string{ "strong": "textbf", "emph": "emph", "code": "texttt", "strike": "sout", "highlight": "underline", } // CalloutTones map a callout's tone to its tcolorbox colours. CalloutTones = map[string]struct{ Background, Frame string }{ "info": {"blue!5!white", "blue!60!black"}, "warn": {"orange!10!white", "orange!70!black"}, "ok": {"green!8!white", "green!50!black"}, } // DefaultTone is used when a callout names a tone this table lacks. DefaultTone = "info" // ListingLanguages map a lower-cased source language to a listings // package language. An absent key renders unhighlighted. ListingLanguages = map[string]string{ "clojure": "Lisp", "clj": "Lisp", "cljs": "Lisp", "cljc": "Lisp", "lisp": "Lisp", "scheme": "Lisp", "elisp": "Lisp", "go": "Go", "golang": "Go", "python": "Python", "py": "Python", "javascript": "Java", "js": "Java", "typescript": "Java", "ts": "Java", "java": "Java", "c": "C", "c++": "C++", "cpp": "C++", "haskell": "Haskell", "hs": "Haskell", "ruby": "Ruby", "rb": "Ruby", "rust": "C", "sql": "SQL", "bash": "bash", "sh": "bash", "shell": "bash", "zsh": "bash", "tex": "TeX", "latex": "TeX", "xml": "XML", "html": "XML", } // PrintableExtensions are the lower-cased file extensions that may reach // \includegraphics. Anything else renders as a placeholder. PrintableExtensions = map[string]bool{ ".pdf": true, ".png": true, ".jpg": true, ".jpeg": true, ".eps": true, } // UnprintableReasons label an unprintable extension on its placeholder. UnprintableReasons = map[string]string{ ".gif": "animated image", ".svg": "vector image — convert to PDF at the asset boundary", } )
These tables are the extension points of the beamer target: each is an open set a caller may add to before building a catalog.
var ( ErrInvalidManifest = errors.New("invalid render manifest") ErrNestedSection = errors.New("section fragments must be document roots") )
var DefaultPackages = []Package{
{Name: "fontenc", Options: "T1"},
{Name: "inputenc", Options: "utf8"},
{Name: "graphicx"},
{Name: "listings"},
{Name: "tcolorbox"},
{Name: "ulem", Options: "normalem"},
{Name: "xcolor"},
{Name: "hyperref"},
}
DefaultPackages are the packages the bundled renderers require.
Functions ¶
func Catalog ¶
Catalog freezes a catalog holding exactly the beamer definitions.
catalog, _ := beamer.Catalog()
engine, _ := api.NewDocumentEngine(catalog, api.DocumentEngineConfig{
Target: beamer.Target,
Projector: beamer.NewProjector(beamer.Options{Theme: "Madrid"}),
})
func Definitions ¶
func Definitions() ([]component.Definition, error)
Definitions returns every component definition for the beamer target.
func Project ¶
func Project(manifest composition.RenderManifest, options Options) (latex.Projection, error)
Project assembles a manifest into a compilable Beamer document, returning the same latex.Projection the LaTeX target produces.
Each root section becomes one \include'd file; flow and artifact fragments are spliced inline into the frame that contains them. Roots must all be section-mode fragments. Project is pure.
Types ¶
type Options ¶
type Options struct {
// DocumentClass defaults to "beamer".
DocumentClass string
// ClassOptions defaults to AspectRatio alone.
ClassOptions []string
// Packages defaults to DefaultPackages. A non-nil empty slice loads none.
Packages []Package
// Preamble replaces DefaultPreamble when set.
Preamble string
// Theme is the Beamer theme name. Empty selects a plain one.
Theme string
// ColorTheme is the Beamer colour theme, or a style file's colour theme
// generated from plato's design tokens.
ColorTheme string
// StyleFile is a .sty to \usepackage after the theme, named without its
// extension. The file itself must reach the workspace, either through
// Files or through the TeX search path.
StyleFile string
// Files are extra workspace-relative files carried into the projection,
// such as the .sty StyleFile names.
Files []latex.File
// TrustedPreamble is appended verbatim. It is trusted: callers must not
// route document content through it.
TrustedPreamble []byte
// FocusSections limits the build to these section components via
// \includeonly. Each must name a root section.
FocusSections []string
// GraphicsPath is prepended to image lookups, letting a projection
// reference assets that live outside the compile workspace.
GraphicsPath string
// Title, Author and Date populate \titlepage when Title is set.
Title, Author, Date string
// ShowNotes renders speaker notes on a second screen.
ShowNotes bool
// AspectRatio is the Beamer aspectratio option; 169 by default.
AspectRatio string
}
Options controls the document shape, its styling, and focused rebuilds. Every field is inert data; Project performs no I/O.
type Projector ¶
type Projector struct {
// contains filtered or unexported fields
}
Projector adapts Project to the engine's projector seam. Options are fixed at construction; a request contributes only its focus sections.
func NewProjector ¶
NewProjector returns a projector that renders every manifest with options.
func (*Projector) ProjectManifest ¶
func (projector *Projector) ProjectManifest(manifest composition.RenderManifest, focusSections []string) (latex.Projection, error)
ProjectManifest satisfies the engine's projector seam.