tabularray icon indicating copy to clipboard operation
tabularray copied to clipboard

tex4ht support

Open blaueente opened this issue 3 years ago • 6 comments

tabularray should have tex4ht support, in order to enable conversion to html

Example from documentation:

\documentclass{article}
\usepackage{tabularray}
\begin{document}

\begin{tblr}{|c|c|c|c|c|}
\hline
\SetCell[r=2]{c} 2 Rows
& \SetCell[c=2]{c} 2 Columns
& & \SetCell[r=2,c=2]{c} 2 Rows 2 Columns & \\
\hline
& 2-2 & 2-3 & & \\
\hline
3-1 & 3-2 & 3-3 & 3-4 & 3-5 \\
\hline
\end{tblr}

\begin{tblr}{|l|[dotted]|[2pt]c|r|[solid]|[dashed]|}
\hline
One & Two & Three \\
\hline\hline[dotted]\hline
Four & Five & Six \\
\hline[dashed]\hline[1pt]
Seven & Eight & Nine \\
\hline
\end{tblr}

\end{document}

Result:

2 Rows 2 Columns 2 Rows 2 Columns 2-2 2-3 3-1 3-2 3-3 3-4 3-5 _____________________________________ ______________ _____________________________________ _____________________________________

One Two Three _ Four Five Six _ Seven Eight Nine _ _______________________ _______________________ ______________________________ _______________________


<!DOCTYPE html> 
<html lang='en-US' xml:lang='en-US'> 
<head><title></title> 
<meta charset='utf-8' /> 
<meta content='TeX4ht (https://tug.org/tex4ht/)' name='generator' /> 
<meta content='width=device-width,initial-scale=1' name='viewport' /> 
<link href='tblr.css' rel='stylesheet' type='text/css' /> 
<meta content='tblr.tex' name='src' /> 
</head><body>
<!-- l. 17 --><p class='noindent'>    2
  Rows       2
          Columns          2
                          Rows
                            2
                         Columns                                     
          2-2   2-3
                                     
   3-1    3-2   3-3   3-4      3-5
                                     _____________________________________
        ______________
_____________________________________
_____________________________________
</p><!-- l. 28 --><p class='noindent'> One     Two   Three        _                
 Four     Five     Six
        _                
 Seven   Eight   Nine
        _                _______________________
_______________________
______________________________
_______________________
</p>
    
</body> 
</html>

Expected: 2022-11-12_12-08

blaueente avatar Nov 12 '22 11:11 blaueente

I think this is a feature request for tex4ht project. And I guess this is the correct place: https://puszcza.gnu.org.ua/bugs/?group=tex4ht

lvjr avatar Nov 12 '22 11:11 lvjr

I don't agree that this is a task only for tex4ht. The hooks needed for tex4ht are quite similar to the hooks needed for tagging, see https://github.com/lvjr/tabularray/issues/27.

u-fischer avatar Nov 27 '22 22:11 u-fischer

I thought tex4ht worked like pandoc. Now I know I was wrong.

I have not yet decided how many hooks should be provided by tabularray.

@u-fischer and @michal-h21: You could leave your comments in issue #197.

lvjr avatar Nov 30 '22 03:11 lvjr

I've just added support for Tabularray to TeX4ht sources. I was able to support most of features, except for complicated lines and text property for vline.

michal-h21 avatar Dec 09 '22 16:12 michal-h21

I decide to reopen this issue to record experiments with tex4ht here.

lvjr avatar Feb 11 '23 01:02 lvjr

@michal-h21 I have tried to improve tex4ht support with public hooks and varaibles based on your code in tex4ht and your comment in issue #197. Please see the latest trial/tabularray.sty file and trial/tex4ht folder in this repository.

I haven't handled the variables for cell alignment and cell widths yet, since they are a little complicated. By the way, I have also fixed a bug that all <tr> tags had the same id atrribute.

lvjr avatar Feb 11 '23 03:02 lvjr