Skip to content

Bikeshed is stripping backslashes from some latex newline commands #1823

Open
@dschuff

Description

@dschuff

Some latex tables in the core spec use the extra space argument to add extra vertical space between table rows, e.g. the \\[1ex] on line 660 of this example from
https://github.com/WebAssembly/spec/blob/main/document/core/exec/runtime.rst?plain=1#L655-L664

.. math::
   \begin{array}{rcl}
   S; F; E[\instr^\ast] &\stepto& S'; F'; E[{\instr'}^\ast] \\
     && (\iff S; F; \instr^\ast \stepto S'; F'; {\instr'}^\ast) \\
   S; F; \FRAME_n\{F'\}~\instr^\ast~\END &\stepto& S'; F; \FRAME_n\{F''\}~\instr'^\ast~\END \\
     && (\iff S; F'; \instr^\ast \stepto S'; F''; {\instr'}^\ast) \\[1ex]
   S; F; E[\TRAP] &\stepto& S; F; \TRAP
     \qquad (\iff E \neq [\_]) \\
   S; F; \FRAME_n\{F'\}~\TRAP~\END &\stepto& S; F; \TRAP \\
   \end{array}

After sphinx, the content of bikeshed_singlehtml/index_fixed.html is

<div class="math notranslate nohighlight">
\[\begin{split}\begin{array}{rcl}
S; F; E[\href{#syntax-instr}{\mathit{instr}}^\ast] &amp;\href{#exec-notation}{\hookrightarrow}&amp; S'; F'; E[{\href{#syntax-instr}{\mathit{instr}}'}^\ast] \\
  &amp;&amp; (\mathrel{\mbox{if}} S; F; \href{#syntax-instr}{\mathit{instr}}^\ast \href{#exec-notation}{\hookrightarrow} S'; F'; {\href{#syntax-instr}{\mathit{instr}}'}^\ast) \\
S; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F'\}~\href{#syntax-instr}{\mathit{instr}}^\ast~\href{#syntax-instr-control}{\mathsf{end}} &amp;\href{#exec-notation}{\hookrightarrow}&amp; S'; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F''\}~\href{#syntax-instr}{\mathit{instr}}'^\ast~\href{#syntax-instr-control}{\mathsf{end}} \\
  &amp;&amp; (\mathrel{\mbox{if}} S; F'; \href{#syntax-instr}{\mathit{instr}}^\ast \href{#exec-notation}{\hookrightarrow} S'; F''; {\href{#syntax-instr}{\mathit{instr}}'}^\ast) \\[1ex]
S; F; E[\href{#syntax-trap}{\mathsf{trap}}] &amp;\href{#exec-notation}{\hookrightarrow}&amp; S; F; \href{#syntax-trap}{\mathsf{trap}}
  \qquad (\mathrel{\mbox{if}} E \neq [\_]) \\
S; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F'\}~\href{#syntax-trap}{\mathsf{trap}}~\href{#syntax-instr-control}{\mathsf{end}} &amp;\href{#exec-notation}{\hookrightarrow}&amp; S; F; \href{#syntax-trap}{\mathsf{trap}} \\
\end{array}\end{split}\]</div>

When Bikeshed processes the file, it strips out one of the backslashes:

         <div class="math notranslate nohighlight"> \[\begin{split}\begin{array}{rcl}
S; F; E[\href{#syntax-instr}{\mathit{instr}}^\ast] &amp;\href{#exec-notation}{\hookrightarrow}&amp; S'; F'; E[{\href{#syntax-instr}{\mathit{instr}}'}^\ast] \\
  &amp;&amp; (\mathrel{\mbox{if}} S; F; \href{#syntax-instr}{\mathit{instr}}^\ast \href{#exec-notation}{\hookrightarrow} S'; F'; {\href{#syntax-instr}{\mathit{instr}}'}^\ast) \\
S; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F'\}~\href{#syntax-instr}{\mathit{instr}}^\ast~\href{#syntax-instr-control}{\mathsf{end}} &amp;\href{#exec-notation}{\hookrightarrow}&amp; S'; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F''\}~\href{#syntax-instr}{\mathit{instr}}'^\ast~\href{#syntax-instr-control}{\mathsf{end}} \\
  &amp;&amp; (\mathrel{\mbox{if}} S; F'; \href{#syntax-instr}{\mathit{instr}}^\ast \href{#exec-notation}{\hookrightarrow} S'; F''; {\href{#syntax-instr}{\mathit{instr}}'}^\ast) \[1ex]
S; F; E[\href{#syntax-trap}{\mathsf{trap}}] &amp;\href{#exec-notation}{\hookrightarrow}&amp; S; F; \href{#syntax-trap}{\mathsf{trap}}
  \qquad (\mathrel{\mbox{if}} E \neq [\_]) \\
S; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F'\}~\href{#syntax-trap}{\mathsf{trap}}~\href{#syntax-instr-control}{\mathsf{end}} &amp;\href{#exec-notation}{\hookrightarrow}&amp; S; F; \href{#syntax-trap}{\mathsf{trap}} \\
\end{array}\end{split}\]</div>

Later this break's katex's rendering of the latex.
I'm not yet sure what's happening here, e.g. whether this is somehow an intended behavior of Bikeshed, or a bug, or what.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions