siefkenj / unified-latex

Utilities for parsing and manipulating LaTeX ASTs with the Unified.js framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[html] Issues with \begin{tabular}

udovin opened this issue · comments

I noticed that there are some problems with \begin{tabular}. For example, \hline are not recognized correctly.

Some examples from Overleaf that incorrectly rendered:

\begin{center}
\begin{tabular}{ |c|c|c| } 
 \hline
 cell1 & cell2 & cell3 \\ 
 cell4 & cell5 & cell6 \\ 
 cell7 & cell8 & cell9 \\ 
 \hline
\end{tabular}
\end{center}

In this case no horizontal lines was rendered.

Also seems like tabular does not support double solid borders:

\begin{center}
\begin{tabular}{||c c c c||} 
 \hline
 Col1 & Col2 & Col2 & Col3 \\ [0.5ex] 
 \hline\hline
 1 & 6 & 87837 & 787 \\ 
 \hline
 2 & 7 & 78 & 5415 \\
 \hline
 3 & 545 & 778 & 7507 \\
 \hline
 4 & 545 & 18744 & 7560 \\
 \hline
 5 & 88 & 788 & 6344 \\ [1ex] 
 \hline
\end{tabular}
\end{center}

What do you mean they are not recognized correctly? The pretty printer at https://siefkenj.github.io/latex-parser-playground/ seems to format both of those examples correctly.

I mean the problem with rendering to html. Only left and right borders are added.

First example:
CB6B88E5-E293-4ACA-B25B-C613E9E322D0

How it was rendered in playground:
54C00FEE-EDE7-4D89-AFAB-65CA18314E51

Thanks, I understand now! I am not sure when I'll have a chance to look at this, but if you want to investigate, the relevant code should be near

function createTableFromTabular(env: Ast.Environment) {