Skip to content

Commit

Permalink
Don't use \lstinline[mathescape=true] for grammar with pieces of math
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed May 5, 2020
1 parent 7ade62e commit 43db6e6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions chapters/packages.tex
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,22 @@ \subsection{Importing Definitions from a Package}\doublelabel{importing-definiti
%TODO-FORMAT Should be formatted using tabs or tabular?
An \lstinline!import!-clause can occur in one of the following syntactic forms:

\lstinline[mathescape=true]!import $\mathit{packagename}$;! (qualified import)
% Note a syntactic form cannot be written as a single \lstinline[mathescape=true] due to LaTeXML problem reported here:
% https://github.com/brucemiller/LaTeXML/issues/1274
% Instead, we need to break up the \lstinline at each piece of math (taking the opportunity to leave the whitespace
% outside both \lstinline and math).

\lstinline!import ${[}\mathit{packagename}$.${]}\mathit{definitionname}$;! (single definition import)
\lstinline!import! $\mathit{packagename}$\lstinline!;! (qualified import)

\lstinline!import ${[}\mathit{packagename}$.${]}${$\mathit{def}_{1}$, $\mathit{def}_{2}$, $\ldots$, $\mathit{def}_{n}$};! (multiple definition import)
\lstinline!import! ${[}\mathit{packagename}$\lstinline!.!${]}\mathit{definitionname}$\lstinline!;! (single definition import)

\lstinline[mathescape=true]!import $\mathit{packagename}$.*;! (unqualified import)
\lstinline!import! ${[}\mathit{packagename}$\lstinline!.!${]}$\lstinline!{!$\mathit{def}_{1}$\lstinline!,! $\mathit{def}_{2}$\lstinline!,! $\ldots$\lstinline!,! $\mathit{def}_{n}$\lstinline!};! (multiple definition import)

\lstinline[mathescape=true]!import $\mathit{shortpackagename}$ = $\mathit{packagename}$;! (renaming import)
\lstinline!import! $\mathit{packagename}$\lstinline!.*;! (unqualified import)

\lstinline!import $\mathit{shortpackagename}$ = ${[}\mathit{packagename}$.${]}\mathit{definitionname}$;! (renaming single def. import)
\lstinline!import! $\mathit{shortpackagename}$ \lstinline!=! $\mathit{packagename}$\lstinline!;! (renaming import)

\lstinline!import! $\mathit{shortpackagename}$ \lstinline!=! ${[}\mathit{packagename}$\lstinline!.!${]}\mathit{definitionname}$\lstinline!;! (renaming single def. import)

Here $\mathit{packagename}$ is the fully qualified name of the imported
package including possible dot notation and $\mathit{definitionname}$ is the
Expand Down

0 comments on commit 43db6e6

Please sign in to comment.