| 168 | |
| 169 | @staticmethod |
| 170 | def build_latex(params: list) -> str: |
| 171 | from .latex_label import expression_to_latex |
| 172 | if not params: |
| 173 | return r"$\emptyset$" |
| 174 | |
| 175 | def _value_texify(s: str) -> str: |
| 176 | """Run value through SLiCAP expression pipeline; fall back to raw LaTeX.""" |
| 177 | s = s.strip() |
| 178 | if not s: |
| 179 | return "" |
| 180 | if not (s.startswith("{") and s.endswith("}")): |
| 181 | s = "{" + s + "}" |
| 182 | return expression_to_latex(s) |
| 183 | |
| 184 | rows = " \\\\\n".join( |
| 185 | f" {_value_texify(name)} & {_value_texify(value)}" |
| 186 | for name, value in params |
| 187 | ) |
| 188 | return ( |
| 189 | r"\[" "\n" |
| 190 | r"\begin{array}{r@{\;=\;}l}" "\n" |
| 191 | r"\multicolumn{2}{c}{\textbf{Parameters}} \\" "\n" |
| 192 | + rows + "\n" |
| 193 | r"\end{array}" "\n" |
| 194 | r"\]" |
| 195 | ) |
| 196 | |
| 197 | def param_lines(self, exclude=None) -> list: |
| 198 | """Return SPICE .param lines for netlist export. |