LaTeX Style & Build Guidelines

For AI Agents: This document defines the MANDATORY pillars for writing, structuring, and generating LaTeX documents for ColivingLiguria. Failure to follow these aesthetic and structural rules results in documents that “feel wrong” or unprofessional.


1. Aesthetic Pillars (The “Premium” Look)

⛔ NO CAPS LOCK (Divieto del “Tutto Maiuscolo”)

  • Rule: Never use ALL CAPS for emphasis in body text or custom titles. It looks aggressive (“yelling”) and amateurish.
  • Correct: \textbf{Premessa Fondamentale} (Bold, Title Case)
  • Incorrect: \textbf{PREMESSA FONDAMENTALE}
  • Why: We convey importance through structure and bold weight, not by capitalization. Standard LaTeX sectioning (\section, \subsection) handles established capitalization styles automatically.

🖌️ Clean Layout (No Random Boxes)

  • Rule: Avoid wrapping text blocks (like specific acceptances) in \fbox, \framebox, or visible borders unless it is a specific bureaucratic form field.
  • Preferred: Use vertical spacing (\vspace) and bold headers (\subsection*) to separate distinct sections (e.g., “Accettazione Specifica”).
  • Goal: A clean, flowing legal document, not a patchwork of boxes.

✒️ Signature Consistency (Macros Only)

  • Rule: NEVER create manual signature lines using underscores (______) or ad-hoc tables.
  • Requirement: Always use the project-wide macros defined in System/pre/pre.tex.
  • Standard Macro: \physicalSignatureBlock{Name}
  • Why: Ensures exact alignment, font size, and spacing consistency across all contracts (Master and Derived).

2. Structural Pillars

🧱 Hierarchy & Article 0

  • Article 0 (Preamble): Used for “Protocontracts” or special conditions.
    • Numbering: Use \setcounter{section}{-1} to force the numbering to “0”.
    • Precedence: Must explicitly state that it prevails over subsequent standard articles in case of conflict.
  • Sections: Use \contractArticle{Title} custom command where available, or standard \section.

🗂️ Bureaucracy Codes

  • Format: XX-XX-NNN (e.g., PR01-, RE-IN-001).
  • Location: Always prominently displayed in the header or cover page via \contractCodeString.

3. Generated Content (Python LaTeX)

When creating Python scripts to generate .tex files (e.g., generate_protocontract.py):

🐍 Syntax Safety

  • Markdown is NOT LaTeX: Never use Markdown syntax (like **bold**) in Python strings intended for LaTeX.
  • Correct: r"\textbf{Text}"
  • Incorrect: "**Text**"
  • Escaping: Use raw strings (r"...") for LaTeX content to handle backslashes (\) correctly.

🧩 Logic Injection

  • Method: Do not rewrite the whole file if possible. Use replace() targeting unique placeholders or known strings (e.g., replacing a specific \contractArticle title with \setcounter{section}{-1} ... \contractArticle).
  • Consistency: The generated file must verify that all aesthetic rules (Signature Macros, No Caps) are applied to the injected content as well.

4. Specific Clauses & Language

  • Supervision: In “Comodato” or passive contracts, explicitly disclaim supervision duties: “Il Comodante NON gestisce, NON organizza e NON supervisiona…” (Remember: use lowercase “non”, bold is enough emphasis).
  • Safety: Prohibitions on dangerous activities (Electrical, Chainsaws) must be explicit and grouped under “Attività Pericolose”.
  • Video Verification: For remote agreements, explicitly cite the method of viewing (e.g., “Video inviati via WhatsApp”) to prove awareness of the property state.

5. Variables & Fillable Fields (The “Hybrid” Method)

To allow documents to be used both as printable forms (hand-filled) and digital instances (compiled with specific data), follow this strict pattern:

🏗️ Declaration at the Top

All specific data points must be defined as variables (NewCommands) at the very beginning of the document (after imports).

% --- VARIABLES (Campi da Compilare) ---
\newcommand{\guestName}{\rule{8cm}{0.4pt}} % Default: Blank line for handwriting
\newcommand{\guestBirth}{\rule{3cm}{0.4pt}}
\newcommand{\guestPassport}{\rule{4cm}{0.4pt}}

✍️ Usage in Text

Never hardcode ”_________” in the text. Always use the variable.

  • Bad: Il signor \rule{5cm}{0.4pt} nato a...
  • Good: Il signor \guestName{} nato a...

🔄 Instantiation (Digital Filling)

When generating a specific version (e.g., for a known guest), you simply redefine the variables before \begin{document}, without touching the body text.

% Override for Specific Instance
\renewcommand{\guestName}{\textbf{Mario Rossi}}
\renewcommand{\guestBirth}{01/01/1990}

This guarantees that the document structure remains identical whether it’s blank or filled.