Skip to content

Tabular columns in mathmode (for .html and others) #10

Open
@cmhughes

Description

@cmhughes

When we write code like the following in .xml

          <table xml:id="exp-tab-salary">
            <caption/>
                    <tgroup tabletype="S[table-format=2.0]S[table-format=10.0]">
                        <thead>
                          <row><entry><m>d</m> (days worked)</entry><entry><m>p</m> (cents)</entry></row>
                        </thead>
                        <tbody>
                          <row><entry>1  </entry><entry>2         </entry></row> 
                          <row><entry>2  </entry><entry>4         </entry></row>
                          <row><entry>3  </entry><entry>8         </entry></row>
                          <row><entry>4  </entry><entry>16        </entry></row>
                          <row><entry>5  </entry><entry>32        </entry></row>
                          <row><entry>10 </entry><entry>1024      </entry></row>
                          <row><entry>30 </entry><entry>1073741824</entry></row>
                      </tbody>
                    </tgroup>
                </table>

we translate into .tex and receive

\begin{tabular}{S[table-format=2.0]S[table-format=10.0]}
\beforeheading 
\heading{$d$ (days worked)}&\heading{$p$ (cents)}\\
\afterheading 
1  &2         \\\normalline
2  &4         \\\normalline
3  &8         \\\normalline
4  &16        \\\normalline
5  &32        \\\normalline
10 &1024      \\\normalline
30 &1073741824\\\lastline
\end{tabular}

The .tex version uses the siunitx package which automatically puts each entry into mathmode. The .html version isn't quite as clever--any ideas on how we can fix this?

One possible (clumsy, heavy) solution is to put each entry into a new tag, perhaps <cm> for 'conditional mathmode' which would do nothing in the .tex version, and put the entry into mathmode for .html and other versions. In such a scheme the above snippet might look like, for example,

<row><entry><cm>1</cm> </entry><entry><cm>2</cm> </entry></row> <row><entry><cm>2</cm> </entry><entry><cm>4</cm> </entry></row>

This raises a more general question: when we hit questions/issues such as this, should we stop until they're resolved, or just plough forward?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions