WebAssembly / WebAssembly/spec

Bikeshed is stripping backslashes from some latex newline commands

Open
#1,823 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
3.5k
Forks
539
Avg merge
2d 1h
Merged PRs (30d)
13

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the LaTeX in core/exec/runtime.rst, especially the \[1ex] row separator, with the generated bikeshed_singlehtml/index_fixed.html. Trace the Sphinx-to-Bikeshed processing step that changes this sequence and verify the resulting KaTeX input. Done means the backslash is preserved and the affected table renders correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
build-system, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.