% ============================================================================== % preamble/cross_referencing.tex % Automated Cross-Referencing: Main Text Badges <--> Appendix Code Listings % ============================================================================== % --- Visual Badge in Main Text (Lean 4: Discreet Inline Link) --- % Usage: \leanref{unique_id}{formal_theorem_symbol}{source_filename} \newcommand{\leanref}[3]{% \hyperref[app:#1]{% \tcbox[ on line, boxrule=0.4pt, colframe=LeanBlue, colback=BadgeGray, arc=1.5pt, left=3.5pt, right=3.5pt, top=2.2pt, bottom=1.6pt, boxsep=0.4pt ]{% \sbox0{\vphantom{Agy}\textsf{\textbf{\color{LeanBlue}\fontsize{7.8}{9.5}\selectfont Lean~\ref*{app:#1}~:}}~}% \usebox0\begin{varwidth}[t]{\dimexpr\linewidth-\wd0-9pt\relax}\raggedright\vphantom{Agy}\texttt{\fontsize{8}{9.5}\selectfont\color{LeanBlue}\detokenize{#2}}\vphantom{Agy}\end{varwidth}% }% }% } % --- Visual Badge Flush Right Below Display Math --- % Usage: \leanrefright{unique_id}{formal_theorem_symbol}{source_filename} \newcommand{\leanrefright}[3]{% \par\vspace{-2pt}\noindent\hfill\leanref{#1}{#2}{#3}\par\vspace{4pt}% } % --- Visual Badge in Main Text (Python: Sober Single-Line Capsule, Option A) --- % Usage: \pythonbadge{unique_id}{modules_list}{precision_or_engine} \newcommand{\pythonbadge}[3]{% \hyperref[app:#1]{% \tcbox[ on line, boxrule=0.4pt, colframe=PythonSlate, colback=BadgeGray, arc=1.5pt, left=3.5pt, right=3.5pt, top=2.2pt, bottom=1.6pt, boxsep=0.4pt ]{% \sbox0{\vphantom{Agy}\textsf{\textbf{\color{PythonSlate}\fontsize{7.8}{9.5}\selectfont Python~\ref*{app:#1}~:}}~}% \usebox0\begin{varwidth}[t]{\dimexpr\linewidth-\wd0-9pt\relax}\raggedright\vphantom{Agy}\texttt{\fontsize{8}{9.5}\selectfont\color{PythonSlate}\detokenize{#2}}~\textsf{\fontsize{7.2}{9}\selectfont\color{PythonMuted}[#3]}\vphantom{Agy}\end{varwidth}% }% }% } % --- Visual Badge Flush Right Below Display Math / Tables / Subsections (Python) --- % Usage: \pythonrefright{unique_id}{modules_list}{precision_or_engine} \newcommand{\pythonrefright}[3]{% \par\vspace{-2pt}\noindent\hfill\pythonbadge{#1}{#2}{#3}\par\vspace{4pt}% } % --- Legacy Aliases Redirected to Sober Flush-Right Capsule --- % Usage: \pythonref{unique_id}{algorithm_symbol}{source_filename} \newcommand{\pythonref}[3]{% \pythonrefright{#1}{#3}{#2}% } % Usage: \pythondualref{unique_id}{symbol_or_class}{interface_filename}{production_module}{line_range} \newcommand{\pythondualref}[5]{% \pythonrefright{#1}{#4}{Float64 / Float128}% } % --- Injection Commands for Appendices (Lean 4) --- % Full file injection: \newcommand{\injectlean}[3]{% \phantomsection\label{app:#1}% \begin{leanbox}{\detokenize{#2}}% \lstinputlisting[language=lean4]{#3}% \end{leanbox}% } % Bounded line-range injection: \newcommand{\injectleanlines}[5]{% \phantomsection\label{app:#1}% \begin{leanbox}{\detokenize{#2} (Lines #4--#5)}% \lstinputlisting[language=lean4, firstline=#4, lastline=#5]{#3}% \end{leanbox}% } % --- Injection Commands for Appendices (Python) --- % Full file injection: \newcommand{\injectpython}[3]{% \phantomsection\label{app:#1}% \begin{pythonbox}{\detokenize{#2}}% \lstinputlisting[language=custompython]{#3}% \end{pythonbox}% } % Bounded line-range injection: \newcommand{\injectpythonlines}[5]{% \phantomsection\label{app:#1}% \begin{pythonbox}{\detokenize{#2} (Lines #4--#5)}% \lstinputlisting[language=custompython, firstline=#4, lastline=#5]{#3}% \end{pythonbox}% } % --- Official Vector Two-Tone Zenodo DOI & GitHub Companion Shield Badges --- \definecolor{ShieldLabelBg}{RGB}{85, 85, 85} \definecolor{ZenodoBlue}{RGB}{0, 126, 198} \newcommand{\zenodoshield}{% \href{https://doi.org/10.5281/zenodo.23982968}{% \tcbox[ enhanced, on line, boxrule=0pt, arc=2pt, colback=ZenodoBlue, colframe=ZenodoBlue, left=0pt, right=5pt, top=1.8pt, bottom=1.8pt, boxsep=0pt ]{% \tcbox[ enhanced, on line, boxrule=0pt, sharp corners=east, arc=2pt, colback=ShieldLabelBg, colframe=ShieldLabelBg, left=5pt, right=5pt, top=1.8pt, bottom=1.8pt, boxsep=0pt ]{\vphantom{Agy}\textsf{\fontsize{7.8}{9.5}\selectfont\color{white}\textbf{DOI}}}% \hspace{5pt}\vphantom{Agy}\textsf{\fontsize{7.8}{9.5}\selectfont\color{white}\textbf{10.5281/zenodo.23982968}}% }% }% } \newcommand{\githubshield}{% \href{https://github.com/jeremynusa-hub/normal_cone_nbody3d}{% \tcbox[ enhanced, on line, boxrule=0pt, arc=2pt, colback=PythonSlate, colframe=PythonSlate, left=0pt, right=5pt, top=1.8pt, bottom=1.8pt, boxsep=0pt ]{% \tcbox[ enhanced, on line, boxrule=0pt, sharp corners=east, arc=2pt, colback=ShieldLabelBg, colframe=ShieldLabelBg, left=5pt, right=5pt, top=1.8pt, bottom=1.8pt, boxsep=0pt ]{\vphantom{Agy}\textsf{\fontsize{7.8}{9.5}\selectfont\color{white}\textbf{GitHub}}}% \hspace{5pt}\vphantom{Agy}\texttt{\fontsize{7.8}{9.5}\selectfont\color{white}\textbf{jeremynusa-hub/normal\_cone\_nbody3d (v1.0.0)}}% }% }% }