Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions source/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,19 @@
%%--------------------------------------------------
\newcommand{\CodeStyle}{\ttfamily}
\newcommand{\CodeStylex}[1]{\texttt{\protect\frenchspacing #1}}
\makeatletter
% Append `\@` to restore proper sentence spacing in text mode. This insertion
% happens only during normal typesetting; it is suppressed for .idx generation.
\newcommand{\CodeStylexGuarded}[1]{\CodeStylex{#1\ifmmode\else\ifx\protect\@typeset@protect\@\fi\fi}}
\makeatother

\definecolor{grammar-gray}{gray}{0.2}

% General grammar style
\newcommand{\GrammarStylex}[1]{\textcolor{grammar-gray}{\textsf{\textit{#1}}}}

% Code and definitions embedded in text.
\newcommand{\tcode}[1]{\CodeStylex{#1}}
\newcommand{\tcode}[1]{\CodeStylexGuarded{#1}}
\newcommand{\term}[1]{\textit{#1}}
\newcommand{\gterm}[1]{\GrammarStylex{#1}}
\newcommand{\fakegrammarterm}[1]{\gterm{#1}}
Expand Down Expand Up @@ -592,7 +597,7 @@
\lstset{escapechar=@, aboveskip=\parskip, belowskip=0pt,
midpenalty=500, endpenalty=-50,
emptylinepenalty=-250, semicolonpenalty=0,upquote=true}%
\renewcommand{\tcode}[1]{\textup{\CodeStylex{##1}}}
\renewcommand{\tcode}[1]{\textup{\CodeStylexGuarded{##1}}}
\renewcommand{\term}[1]{\textit{##1}}%
\renewcommand{\grammarterm}[1]{\gterm{##1}}%
}
Expand Down Expand Up @@ -650,7 +655,7 @@
belowskip=0ex % leave this alone: it keeps these things out of the
% footnote area
}%
\renewcommand{\tcode}[1]{\textup{\CodeStylex{##1}}}
\renewcommand{\tcode}[1]{\textup{\CodeStylexGuarded{##1}}}
}
{
}
Expand Down