PWR-HYBRID-3/journal/preamble.tex
Dane Sabo fa45e96fd1 journal: scaffold + 2 retroactive invention-log entries
journal/ directory, LaTeX-based, dated entries, callout boxes for
derivations / decisions / dead ends / limitations, plus an \apass{}
macro for in-line markers when a later deep-pass is needed.

Retroactive A-style entries for 2026-04-17 (controllers, linearization,
LQR, operation-mode linear reach, Lyapunov barrier) and 2026-04-20
(predicates restructure into deadbands+safety+invariants, OL-vs-CL
barrier analysis, mode-obligation taxonomy, heatup-rate-as-halfspace,
mode_boundaries, first Julia nonlinear reach attempt).

Both entries include derivations written out in math, dead-ends I
hit, code snippets with commentary, figure embeds, and terminal
output where it changed what we did next.  The goal is invention-log
depth — readable 4 years from now without the git history to help.

journal/README.md documents the conventions.  journal.tex aggregates
all entries into one PDF via latexmk.

Kept claude_memory/ separate as per earlier agreement — those are
short AI-context notes, different audience.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 21:37:59 -04:00

177 lines
5.3 KiB
TeX

% preamble.tex — shared LaTeX setup for the HAHACS lab journal.
%
% Intent: a reader in 2030 picks up this journal and can rebuild the
% work from scratch. This file defines the visual vocabulary — code
% listings, figures, callouts — that each dated entry uses.
\documentclass[11pt, letterpaper]{article}
% --- Page geometry ------------------------------------------------------------
\usepackage[margin=1in, headheight=15pt]{geometry}
\usepackage{parskip} % blank line between paragraphs; no indent
\usepackage{microtype}
% --- Fonts --------------------------------------------------------------------
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{inconsolata} % monospaced font for code
% --- Math ---------------------------------------------------------------------
\usepackage{amsmath, amssymb, amsthm, mathtools}
\usepackage{siunitx}
\sisetup{detect-all, per-mode=symbol}
% --- Graphics -----------------------------------------------------------------
\usepackage{graphicx}
\graphicspath{{./figures/}{../docs/figures/}}
\usepackage{caption}
\captionsetup{font=small, labelfont=bf}
% --- Code listings ------------------------------------------------------------
\usepackage{listings}
\usepackage{xcolor}
% Palette
\definecolor{code-bg}{HTML}{F7F7F2}
\definecolor{code-rule}{HTML}{D0D0C8}
\definecolor{code-comment}{HTML}{708070}
\definecolor{code-keyword}{HTML}{0050A0}
\definecolor{code-string}{HTML}{A04060}
\definecolor{code-number}{HTML}{806010}
\lstdefinelanguage{Julia}%
{morekeywords={abstract,break,case,catch,const,continue,do,else,elseif,%
end,export,false,for,function,immutable,import,importall,if,in,%
macro,module,otherwise,quote,return,struct,switch,true,try,type,%
typealias,using,while,mutable,global,local,let,primitive,where},%
sensitive=true,%
morecomment=[l]\#,%
morecomment=[n]{\#=}{=\#},%
morestring=[s]{"}{"},%
morestring=[m]{'}{'},%
}
\lstdefinestyle{labstyle}{
backgroundcolor=\color{code-bg},
basicstyle=\ttfamily\small,
breaklines=true,
breakatwhitespace=false,
captionpos=b,
commentstyle=\color{code-comment}\itshape,
frame=single,
framerule=0.5pt,
rulecolor=\color{code-rule},
keywordstyle=\color{code-keyword}\bfseries,
numberstyle=\tiny\color{code-comment},
showspaces=false,
showstringspaces=false,
showtabs=false,
stringstyle=\color{code-string},
tabsize=2,
numbers=left,
numbersep=6pt,
xleftmargin=14pt
}
\lstset{style=labstyle}
\lstdefinestyle{terminal}{
backgroundcolor=\color{black!90},
basicstyle=\ttfamily\small\color{green!80!white},
commentstyle=\color{white!60},
frame=none,
numbers=none,
breaklines=true,
xleftmargin=0pt
}
% --- Callout boxes ------------------------------------------------------------
\usepackage[most]{tcolorbox}
\newtcolorbox{limitation}[1][]{%
colback=red!5!white,
colframe=red!55!black,
title=\textbf{Limitation},
fonttitle=\bfseries,
boxrule=0.6pt,
arc=2pt,
left=6pt, right=6pt, top=4pt, bottom=4pt,
#1
}
\newtcolorbox{derivation}[1][]{%
colback=blue!3!white,
colframe=blue!40!black,
title=\textbf{Derivation},
fonttitle=\bfseries,
boxrule=0.6pt,
arc=2pt,
left=6pt, right=6pt, top=4pt, bottom=4pt,
#1
}
\newtcolorbox{deadend}[1][]{%
colback=gray!8!white,
colframe=gray!50!black,
title=\textbf{Dead end},
fonttitle=\bfseries,
boxrule=0.5pt,
arc=2pt,
borderline west={2pt}{0pt}{gray!40},
left=6pt, right=6pt, top=4pt, bottom=4pt,
#1
}
\newtcolorbox{decision}[1][]{%
colback=green!3!white,
colframe=green!35!black,
title=\textbf{Decision},
fonttitle=\bfseries,
boxrule=0.6pt,
arc=2pt,
left=6pt, right=6pt, top=4pt, bottom=4pt,
#1
}
% TODO-for-A-pass marker: highlighted so we can find them for later deep-pass.
\newcommand{\apass}[1]{%
{\fboxsep=2pt\colorbox{orange!20}{\textbf{[A-pass]}}\,\textit{#1}}
}
% --- Session header ----------------------------------------------------------
% Usage: \session{2026-04-17}{afternoon, ~5 hr}{summary line}
\newcommand{\session}[3]{%
\noindent\rule{\linewidth}{0.8pt}
\vspace{2pt}
\noindent\textbf{\Large Session: #1} \hfill \textit{#2}\par
\vspace{2pt}
\noindent\emph{#3}\par
\vspace{4pt}
\noindent\rule{\linewidth}{0.4pt}
\vspace{6pt}
}
% --- Code macros --------------------------------------------------------------
\newcommand{\juliafile}[2][]{\lstinputlisting[language=Julia,caption={#2},#1]{#2}}
\newcommand{\matlabfile}[2][]{\lstinputlisting[language=Matlab,caption={#2},#1]{#2}}
\newcommand{\pyfile}[2][]{\lstinputlisting[language=Python,caption={#2},#1]{#2}}
% --- Cross-reference helpers --------------------------------------------------
\usepackage[colorlinks=true, linkcolor=blue!50!black, citecolor=blue!40!black,
urlcolor=teal!60!black]{hyperref}
\usepackage{bookmark}
\usepackage{cleveref}
% --- Headers & footers --------------------------------------------------------
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{HAHACS lab journal}
\fancyhead[R]{\leftmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.3pt}
% --- A small quiet easter egg for anyone who greps the preamble ---------------
% "Looks ordinary on the surface but is something else underneath."
% — the name behind Split. Keep the journal honest; under every summary
% there's a derivation; under every derivation there's a doubt.