boofun.visualization.latex_export

LaTeX/TikZ Export for Boolean Function Visualizations.

This module provides comprehensive LaTeX export for: - Fourier spectrum diagrams - Influence bar charts - Decision trees - Function family comparison tables - Boolean cube visualizations

Functions

export_comparison_table(functions[, properties])

Export comparison table of multiple functions.

export_cube_tikz([n, labels])

Export Boolean cube visualization as TikZ.

export_fourier_tikz(f[, var_names, width, ...])

Export Fourier spectrum as TikZ bar chart.

export_influences_tikz(f[, var_names, ...])

Export influences as TikZ bar chart.

export_spectrum_table(f[, var_names, max_rows])

Export Fourier spectrum as LaTeX table.

Classes

LaTeXExporter(f[, var_names])

Unified LaTeX exporter for Boolean function visualizations.

boofun.visualization.latex_export.export_fourier_tikz(f: BooleanFunction, var_names: List[str] | None = None, width: float = 10, height: float = 5, highlight_threshold: float = 0.1, show_labels: bool = True) str[source]

Export Fourier spectrum as TikZ bar chart.

Parameters:
  • f – Boolean function

  • var_names – Variable names for subset labels

  • width – Chart width in cm

  • height – Chart height in cm

  • highlight_threshold – Highlight coefficients above this

  • show_labels – Show subset labels on x-axis

Returns:

TikZ code string

boofun.visualization.latex_export.export_influences_tikz(f: BooleanFunction, var_names: List[str] | None = None, width: float = 8, height: float = 5, horizontal: bool = True) str[source]

Export influences as TikZ bar chart.

Parameters:
  • f – Boolean function

  • var_names – Variable names

  • width – Chart width in cm

  • height – Chart height in cm

  • horizontal – Use horizontal bars

Returns:

TikZ code string

boofun.visualization.latex_export.export_cube_tikz(n: int = 3, labels: bool = True) str[source]

Export Boolean cube visualization as TikZ.

Parameters:
  • n – Number of dimensions (2, 3, or 4)

  • labels – Show vertex labels

Returns:

TikZ code string

boofun.visualization.latex_export.export_comparison_table(functions: Dict[str, BooleanFunction], properties: List[str] = None) str[source]

Export comparison table of multiple functions.

Parameters:
  • functions – Dict mapping names to BooleanFunction objects

  • properties – List of properties to compare

Returns:

LaTeX table string

boofun.visualization.latex_export.export_spectrum_table(f: BooleanFunction, var_names: List[str] | None = None, max_rows: int = 16) str[source]

Export Fourier spectrum as LaTeX table.

Parameters:
  • f – Boolean function

  • var_names – Variable names

  • max_rows – Maximum rows to show

Returns:

LaTeX table string

class boofun.visualization.latex_export.LaTeXExporter(f: BooleanFunction, var_names: List[str] | None = None)[source]

Unified LaTeX exporter for Boolean function visualizations.

__init__(f: BooleanFunction, var_names: List[str] | None = None)[source]

Initialize exporter.

Parameters:
  • f – Boolean function

  • var_names – Variable names

fourier_spectrum(**kwargs) str[source]

Export Fourier spectrum as TikZ.

influences(**kwargs) str[source]

Export influences as TikZ.

spectrum_table(**kwargs) str[source]

Export spectrum as LaTeX table.

preamble() str[source]

Get required LaTeX preamble.

full_document(*contents: str) str[source]

Wrap content in a complete LaTeX document.

Parameters:

*contents – TikZ/table content strings

Returns:

Complete LaTeX document

save(filename: str, *contents: str, full_doc: bool = True)[source]

Save LaTeX to file.

Parameters:
  • filename – Output filename

  • *contents – Content strings

  • full_doc – Wrap in complete document