Abhi-1U / texor

Converting 'LaTeX' 'R Journal' Articles into 'RJ-web-articles'
https://abhi-1u.github.io/texor/
Other
7 stars 2 forks source link

JG: table issues #63

Open hturner opened 1 year ago

hturner commented 1 year ago

Comment from @ajrgodfrey

Navigating tables such as Table 2 in RJ-2012-006 is difficult because row and column headers are not correctly identified and marked up with <th> tags

Unfortunately LaTeX does not mark up row and column headers in an unambiguous way, however we might do better by inferring structure from tables that use \multicolumn. In this example,

\toprule
  && \multicolumn{5}{c}{Class} \\ 

implies that we have two levels of row headers (indicated by &&) and at least two levels of column headers (since the \multicolumn would almost surely be paired with another row of minor column headers nested within this major column header). If there is no \multicolumn in the next row, then we can assume there is no further nesting, i.e. exactly two levels of column headers. This may be a bit tricky to implement though.

We could at least try to ensure that \multicolumn is correctly handled though, so that it correctly spans the relevant columns, e.g.

<table>
  <colgroup span="2"></colgroup>
  <colgroup span="5"></colgroup>
  <tr>
    <td colspan="2"></td>
    <th colspan="5" scope="colgroup">Class</th>
  </tr>
  <tr>
    <td>A</td>
    <td>B</td>
    <td>1</td>
    <td>2</td>
    <td>3</td>
    <td>4</td>
    <td>5</td>
  </tr>
</table>

This would at least avoid the screen reader navigating through empty cells in the first header row cause by converting multicolumn headers to one header plus several blank cells.