latexdsl/latex_helpers

Source   Edit  

Types

AlignmentKind = enum
  akNone = "", akLeft = "left", akRight = "right", akCenter = "center"
Source   Edit  
DataFrameLike = concept df
    df.getKeys() is seq[string]
    df.row(int) is ValueLike
    df.len is int
Source   Edit  
ValueLike = concept v
    $v[string] is string
    $v is string
Source   Edit  

Procs

proc figure(path: string; caption = ""; width = ""; height = "";
            location = "htbp"; label = ""; checkFile = false): string {.
    ...raises: [ValueError], tags: [ReadDirEffect], forbids: [].}
creates a full figure environment, with a given caption. Either a width or height has to passed, otherwise it will raise ValueError. The figure placement can be controlled via location. Finally, if checkFile is set to true we perform a runtime check on whether the path points to a valid existing file. In many cases this is not desired behavior (TeX code may be generated for figures, which will be generated at a later time), but it can provide a convenient check if one piece of code is generating both plot and TeX code! Source   Edit  
func tableRow(s: varargs[string]): string {....raises: [], tags: [], forbids: [].}
simply joins a variable number of arguments to a valid row of a TeX table Source   Edit  
func textheight[T](arg: T = ""): string
Source   Edit  
func textwidth[T](arg: T = ""): string
Source   Edit  
proc toTexTable(df: DataFrameLike; caption = ""; label = ""; alignment = "left";
                location = "htbp"): string
Turns a DataFrame into a TeX table. If alignment it overrides the tabular alignment argument (e.g. l l l) It's possible to set the alignment via:
  • left, right, center then the number of columns is determined from the data frame, but they are all aligned accordingly.
  • hand a valid TeX string for alignment
Source   Edit