|
235 | 235 | %%-------------------------------------------------- |
236 | 236 | \newcommand{\CodeStyle}{\ttfamily} |
237 | 237 | \newcommand{\CodeStylex}[1]{\texttt{\protect\frenchspacing #1}} |
| 238 | +\makeatletter |
| 239 | +% Append `\@` to restore proper sentence spacing in text mode. This insertion |
| 240 | +% happens only during normal typesetting; it is suppressed for .idx generation. |
| 241 | +\newcommand{\CodeStylexGuarded}[1]{\CodeStylex{#1\ifmmode\else\ifx\protect\@typeset@protect\@\fi\fi}} |
| 242 | +\makeatother |
238 | 243 |
|
239 | 244 | \definecolor{grammar-gray}{gray}{0.2} |
240 | 245 |
|
241 | 246 | % General grammar style |
242 | 247 | \newcommand{\GrammarStylex}[1]{\textcolor{grammar-gray}{\textsf{\textit{#1}}}} |
243 | 248 |
|
244 | 249 | % Code and definitions embedded in text. |
245 | | -\newcommand{\tcode}[1]{\CodeStylex{#1}} |
| 250 | +\newcommand{\tcode}[1]{\CodeStylexGuarded{#1}} |
246 | 251 | \newcommand{\term}[1]{\textit{#1}} |
247 | 252 | \newcommand{\gterm}[1]{\GrammarStylex{#1}} |
248 | 253 | \newcommand{\fakegrammarterm}[1]{\gterm{#1}} |
|
592 | 597 | \lstset{escapechar=@, aboveskip=\parskip, belowskip=0pt, |
593 | 598 | midpenalty=500, endpenalty=-50, |
594 | 599 | emptylinepenalty=-250, semicolonpenalty=0,upquote=true}% |
595 | | -\renewcommand{\tcode}[1]{\textup{\CodeStylex{##1}}} |
| 600 | +\renewcommand{\tcode}[1]{\textup{\CodeStylexGuarded{##1}}} |
596 | 601 | \renewcommand{\term}[1]{\textit{##1}}% |
597 | 602 | \renewcommand{\grammarterm}[1]{\gterm{##1}}% |
598 | 603 | } |
|
650 | 655 | belowskip=0ex % leave this alone: it keeps these things out of the |
651 | 656 | % footnote area |
652 | 657 | }% |
653 | | - \renewcommand{\tcode}[1]{\textup{\CodeStylex{##1}}} |
| 658 | + \renewcommand{\tcode}[1]{\textup{\CodeStylexGuarded{##1}}} |
654 | 659 | } |
655 | 660 | { |
656 | 661 | } |
|
0 commit comments