# nasa/nasa-latex-docs architecture

> Architecture diagram of the GitHub repository nasa/nasa-latex-docs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nasa/nasa-latex-docs
- Repository: https://github.com/nasa/nasa-latex-docs

## Overview

##### Main Components
- Build Automation and Document Compilation:
- Python Build Script (support/buildPDF.py) – Implements an OS-independent routine to compile any LaTeX document.
- Latexmk Configuration (support/latexmk/latexmkrc) – Provides specific configuration for running the LaTeX compilation process and error/warning detection.
- Document Templates and Examples:
- Templates Directory (support/templates) – Contains subdirectories for AIAA, standalone, and tech templates. Each has multiple .tex template files tailored for different document types.
- Sample Content/Template Details (support/templates/doc-params.tex, etc.) – Additional settings and parameters for customization.
- Document Content and Assets:
- Citations (support/citations) – Contains citation style files (aiaa.bbx, aiaa.cbx) tailored for specific formats.
- Bibliography, Figures, and Document Resources (support/document) – Holds the main .tex source file, bibliography files, figures, and sample content.
- Export and Auxiliary Assets:
- Export Directory (support/export) – Possibly contains pre-formatted exports or sample output documents (.tex and .pdf).
- Images (support/images) – Hosts logos and coversheet PDFs.
- Additional Packages and Custom LaTeX Commands:
- Packages (support/packages) – Contains custom packages and style files (e.g., mcode.sty) used by the main LaTeX documents.
- Class Files (nasa-latex-docs.cls) – The class file that defines the core formatting.

##### Relationships and Interactions
- The build automation (via the Python build script and Latexmk configuration) orchestrates the compilation of LaTeX documents.
- When a user creates or modifies a document (in support/document or using a template in support/templates), the build script is invoked to process the LaTeX source.
- The LaTeX compiler then pulls in the class file (nasa-latex-docs.cls), necessary packages (from support/packages), citation files (support/citations), and image assets (support/images) to produce the final output.
- Exports and conversions may be handled within the support/export directory where additional formats or further processing scripts are housed.

##### Architectural Patterns and Design Principles
- Modular Design: Different directories handle separate concerns – building, templating, citations, and exports are isolated. This separation enhances maintainability and clarity.
- Extensibility: With multiple templates and package definitions, the system is designed for flexibility (supporting AIAA, tech, and standalone document types).
- Automation and Integration: The use of a Python build script integrated with Latexmk ensures that building documents is automated and uniform across platforms.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Build Automation & Compilation"
        BP["Python Build Script"]:::automation
        LM["Latexmk Configuration"]:::automation
    end

    subgraph "Templates & Document Examples"
        T["Templates Directory"]:::template
        TP["Template Parameters"]:::template
    end

    subgraph "Document Content & Assets"
        DC["Main LaTeX Document & Resources"]:::content
        CIT["Citation Files"]:::content
    end

    subgraph "Export & Auxiliary Assets"
        EXP["Exported Documents"]:::export
        IMG["Images (Logos and Coversheet)"]:::export
    end

    subgraph "Additional Packages & Custom LaTeX Commands"
        PKG["Custom Packages & Style Files"]:::packages
        CLS["LaTeX Class File"]:::packages
    end

    %% Flow connections
    BP -->|"triggers"| DC
    TP -->|"configures"| T
    T -->|"provides template for"| DC
    DC -->|"utilizes"| CLS
    DC -->|"includes"| PKG
    DC -->|"integrates"| CIT
    DC -->|"incorporates"| IMG
    BP -->|"invokes"| LM
    DC -->|"exports to"| EXP

    %% Click events for components
    click BP "https://github.com/nasa/nasa-latex-docs/blob/master/support/buildPDF.py"
    click LM "https://github.com/nasa/nasa-latex-docs/tree/master/support/latexmk/latexmkrc"
    click T "https://github.com/nasa/nasa-latex-docs/tree/master/support/templates"
    click TP "https://github.com/nasa/nasa-latex-docs/blob/master/support/templates/doc-params.tex"
    click DC "https://github.com/nasa/nasa-latex-docs/tree/master/support/document"
    click CIT "https://github.com/nasa/nasa-latex-docs/tree/master/support/citations/aiaa"
    click EXP "https://github.com/nasa/nasa-latex-docs/tree/master/support/export"
    click IMG "https://github.com/nasa/nasa-latex-docs/tree/master/support/images"
    click PKG "https://github.com/nasa/nasa-latex-docs/tree/master/support/packages"
    click CLS "https://github.com/nasa/nasa-latex-docs/blob/master/support/nasa-latex-docs.cls"

    %% Styles
    classDef automation fill:#F9C74F,stroke:#000,stroke-width:2px;
    classDef template fill:#90BE6D,stroke:#000,stroke-width:2px;
    classDef content fill:#F9844A,stroke:#000,stroke-width:2px;
    classDef export fill:#577590,stroke:#000,stroke-width:2px;
    classDef packages fill:#277DA1,stroke:#000,stroke-width:2px;
```
