(self, s: str, loc: int, toks: ParseResults)
| 2506 | return hlist |
| 2507 | |
| 2508 | def operatorname(self, s: str, loc: int, toks: ParseResults) -> T.Any: |
| 2509 | self.push_state() |
| 2510 | state = self.get_state() |
| 2511 | state.font = 'rm' |
| 2512 | hlist_list: list[Node] = [] |
| 2513 | # Change the font of Chars, but leave Kerns alone |
| 2514 | name = toks["name"] |
| 2515 | for c in name: |
| 2516 | if isinstance(c, Char): |
| 2517 | c.font = 'rm' |
| 2518 | c._update_metrics() |
| 2519 | hlist_list.append(c) |
| 2520 | elif isinstance(c, str): |
| 2521 | hlist_list.append(Char(c, state)) |
| 2522 | else: |
| 2523 | hlist_list.append(c) |
| 2524 | next_char_loc = loc + len(name) + 1 |
| 2525 | if isinstance(name, ParseResults): |
| 2526 | next_char_loc += len('operatorname{}') |
| 2527 | next_char = next((c for c in s[next_char_loc:] if c != ' '), '') |
| 2528 | delimiters = self._delims | {'^', '_'} |
| 2529 | if next_char not in delimiters: |
| 2530 | # Add thin space except when followed by parenthesis, bracket, etc. |
| 2531 | hlist_list += [self._make_space(self._space_widths[r'\,'])] |
| 2532 | self.pop_state() |
| 2533 | # If followed by a sub/superscript, set flag to true to tell subsuper |
| 2534 | # to add space after this operator. |
| 2535 | self._needs_space_after_subsuper = next_char in {'^', '_'} |
| 2536 | return Hlist(hlist_list) |
| 2537 | |
| 2538 | def start_group(self, toks: ParseResults) -> T.Any: |
| 2539 | self.push_state() |
no test coverage detected