tex4ht and tables

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hi,

I am trying to convert a latex document into HTML. The document includes 
   several tables which should all have one of two layouts (columns 
width). Unfortunately, when I convert my document with tex4ht, the 
layouts of the tables are not specified in the html file and are left to 
the browser. Said another way,in the following command

  \begin{tabular}[pos]{cols}
  column 1 entry & column 2 entry ... & column n entry \\
  .
  .
  .
  \end{tabular}

the cols specification is not retained.

At the moment I have achieved my goal by defining two new commands

\newcommand{\htmlmaintablehead}{}
\newcommand{\htmlsubtablehead}{}

which are asserted just before \begin{tabular} (one of the two commands, 
depending on the desired layout).
Since they do nothing, they do not disturb LaTeX or pdfLaTeX, but now I 
can use them in the .cfg file to change the tex4ht hooks of the tabular 
environment:

\NewConfigure{htmlsubtablehead}[1]{\def\hooksubtablehead{#1}}

\def\htmlmaintablehead#1{\hookmaintablehead#1}
\Configure{htmlmaintablehead}{
   \Configure{tabular}
   {\HCode{<table class="tabular" cellspacing="0pt"
       cellpadding="0" frame="void">
       <colgroup class="maintable">
       <col width="160">
       <col width="500">
       </colgroup>}}
   {\HCode{</table>}}
   {\HCode{<tr valign="baseline" class="maintablerow">}}
   {\HCode{</tr>}}
   {\HCode{<td  align="left" class="maintableentry">}}
   {\HCode{</td>}} }

Admittedly this is not very straightforward. I have discovered tex4ht 
just two day ago and I am wondering if there is a simpler method.

Thank you for any suggestion.
Fede

0
Reply beffa (6) 2/13/2004 3:08:59 PM

See related articles to this posting

Federico Beffa wrote:
> 
> Hi,
> 
> I am trying to convert a latex document into HTML. The document includes 
>   several tables which should all have one of two layouts (columns 
> width). Unfortunately, when I convert my document with tex4ht, the 
> layouts of the tables are not specified in the html file and are left to 
> the browser. Said another way,in the following command
> 
>  \begin{tabular}[pos]{cols}
>  column 1 entry & column 2 entry ... & column n entry \\
>  .
>  .
>  .
>  \end{tabular}
> 
> the cols specification is not retained.
 > ...
> I have discovered tex4ht 
> just two day ago and I am wondering if there is a simpler method.
> 
> Thank you for any suggestion.
> Fede
> 

Try TtH:

http://hutchinson.belmont.ma.us/tth/

Ian Hutchinson.

0
Reply hutch2980 (34) 2/14/2004 9:57:56 PM

On Sat, 14 Feb 2004, Ian Hutchinson wrote:

> Federico Beffa wrote:
> >
> > Hi,
> >
> > I am trying to convert a latex document into HTML. The document includes
> >   several tables which should all have one of two layouts (columns
> > width). Unfortunately, when I convert my document with tex4ht, the
> > layouts of the tables are not specified in the html file and are left to
> > the browser. Said another way,in the following command
> >
> >  \begin{tabular}[pos]{cols}
> >  column 1 entry & column 2 entry ... & column n entry \\
> >  .
> >  .
> >  .
> >  \end{tabular}
> >
> > the cols specification is not retained.
>  > ...
> > I have discovered tex4ht
> > just two day ago and I am wondering if there is a simpler method.
> >
> > Thank you for any suggestion.
> > Fede
> >
>
> Try TtH:
>
> http://hutchinson.belmont.ma.us/tth/
>
> Ian Hutchinson.
>
>


Thank you for your suggestion. I have tried Tth, and it does a good
job with tabular. Unfortunately, it has problems with \newlength, and
when LaTeX macros get redefined.

I am happy with the very dynamic configurability and capability of
tex4ht. The one point which is disturbing me, is that when the width of
a column of a tabular environment is specified with p{width}, this is
not reproduced in the HTML output. This seems to me a basic need, but I
have not found a *simple* way to make it work.
I were happy to find a simple way to achieve this with tex4ht.

Fede


0
Reply beffa (6) 2/15/2004 1:27:25 PM

>    several tables which should all have one of two layouts (columns 
> width). Unfortunately, when I convert my document with tex4ht, the 
> layouts of the tables are not specified in the html file and are left to 
> the browser. 

I modified tex4ht (in the bug fixes distribution) to allow for width
specifications of p-columns through the command line option `p-width'.

This command line option activates a configuration similar to the
following ones.

   \Configure{HColWidth}
      {\HCode{ style="width:\HColWidth"}}
  
   \Configure{HColWidth}
      {\HCode{ style="width:
                      \ifnum \HCol=1 160\fi
                      \ifnum \HCol=3 500\fi
       "}}

Try the above examples with, for instance, the following source under
different font sizes in the browser.

   \begin{tabular}{p{2cm}cp{3cm}}
   1 2 3 1 2 3 1 2 3 1 2 3 & x & 1 2 3 1 2 3 1 2 3 1 2 3
   \end{tabular}

The configuration provided through the command line option `p-width'
takes to some degree into account the size of fonts in use within the
HTML displays.  Yet, not all the browsers react properly to the size
changes.

-eitan


0
Reply gurari (142) 2/15/2004 10:28:58 PM

On 15 Feb 2004, Eitan Gurari wrote:

>
> >    several tables which should all have one of two layouts (columns
> > width). Unfortunately, when I convert my document with tex4ht, the
> > layouts of the tables are not specified in the html file and are left to
> > the browser.
>
> I modified tex4ht (in the bug fixes distribution) to allow for width
> specifications of p-columns through the command line option `p-width'.
>
> This command line option activates a configuration similar to the
> following ones.
>
>    \Configure{HColWidth}
>       {\HCode{ style="width:\HColWidth"}}
>
>    \Configure{HColWidth}
>       {\HCode{ style="width:
>                       \ifnum \HCol=1 160\fi
>                       \ifnum \HCol=3 500\fi
>        "}}
>
> Try the above examples with, for instance, the following source under
> different font sizes in the browser.
>
>    \begin{tabular}{p{2cm}cp{3cm}}
>    1 2 3 1 2 3 1 2 3 1 2 3 & x & 1 2 3 1 2 3 1 2 3 1 2 3
>    \end{tabular}
>
> The configuration provided through the command line option `p-width'
> takes to some degree into account the size of fonts in use within the
> HTML displays.  Yet, not all the browsers react properly to the size
> changes.
>
> -eitan
>

Thank you for the help! I have installed the new release (bugfix) and
it is working as desired. However, I think you have introduced a new
bug in the code. In fact, if I compile a file with the "info" option,
then I become the following error:

....
(/home/beffa/texmf/tex/generic/tex4ht/tex4ht.4ht
::::::::::::::::::::::::::::::::::::::::::
 TeX4ht info is available in the log file
::::::::::::::::::::::::::::::::::::::::::
) (/home/beffa/texmf/tex/generic/tex4ht/tex4ht.sty
--- needs --- tex4ht simple ---
(./simple.tmp) (./simple.xref)
(/home/beffa/texmf/tex/generic/tex4ht/info4ht.4ht)
(/home/beffa/texmf/tex/generic/tex4ht/infoht4.4ht
! Missing number, treated as zero.
<to be read again>
                   t
l.3 ...\infoIVht#1//{}\fi\infoIVht[tml4ch1]76...//

?

-----------------
The above error does not show up without the "info" option.

Fede

0
Reply beffa (6) 2/16/2004 2:54:19 PM

> I think you have introduced a new
> bug in the code. In fact, if I compile a file with the "info" option,

Thanks. I loaded new files with a fix to the problem. -eitan



0
Reply gurari (142) 2/16/2004 4:07:09 PM
comp.text.tex 36144 articles. 68 followers. Post

5 Replies
99 Views

Similar Articles

[PageSpeed] 48

  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

tex4ht
Dear Sir, this is my input.tex file: \documentclass{article} \usepackage{dcolumn} \newcolumntype{d}[1]{D{.}{.}{#1}} \begin{document} \begin{tabular}{@{}ld{3,2}d{3,2}d{3,2}d{3,2}d{3,2}d{2,3}@{}} \multicolumn{7}{@{}l}{Autonomy}\\ 1. Complete & 100 & 23 & 21 & 106 & 39 & 29 \\ (\%) & 33.6\% & 7.5\% & 13.8\% & 35.9\% & 13.0\% & 19.3\% \\ 2. Partial & 178 & 227 & 107 & 154 & 177 & 86 \\ (\%) & 59.7\% & 74.4\% & 70.4\% & 52.2\% & 59.2\% & 57.3\% \end{tabular} \end{document} when I run ...

Table of contents format with TeX4ht
Greetings. I am using TeX4ht to generate an XHTML version of my LaTeX document. By default TeX4ht indents subsections and subsubsections in the table of contents with non-breaking spaces. I would prefer that it used nested HTML unordered list environments (<ul>...</ul>) instead so that its tables of contents are neater and resemble those produced by, say, HEVEA. I can't figure out how to do this. Here's the configuration file I made, which is the best I can do: \Preamble{html} \begin{document} \ConfigureToc{section}{\HCode{<li>}}{~}{}{\HCode{</li>}} \Con...

tex4ht, question for gurus about table of contents
Hi, When I use tableofcontents, I get someting like: %%%%%%%%%%%%%% <div class="tableofcontents"> <span class="sectionToc"><a href="#x1-1000" id="QQ2-1-1">section1</a></span><br> <span class="sectionToc"><a href="#x1-3000" id="QQ2-1-3">section2</a></span> </div> %%%%%%%%%%%%%% I want to use the table of contents in a javascript so I need to fromat it as: %%%%%%%%%%%%% item[1]=["#x1-1000","section1"] item[1]=["#x1-3000","sec...

TABLES TABLES TABLES
How would you best describe to a retiscent SAS student that the concept of TABLES isn't limited to SQL? This came up during a discussion on table lookup methods - and lookup tables in particular (I mean, lookup tables pre- date SQL). Even SAS data sets are referred to as tables. This made the student apoplectic. Words of wisdom most welcome!!! Thanks, Howard sasbum@AOL.COM wrote: >How would you best describe to a retiscent SAS student that the concept of >TABLES isn't limited to SQL? This came up during a discussion on table >lookup methods - and lookup tables in partic...

Re: TABLES TABLES TABLES
sasbum@AOL.COM wrote: >How would you best describe to a retiscent SAS student that the concept of >TABLES isn't limited to SQL? This came up during a discussion on table >lookup methods - and lookup tables in particular (I mean, lookup tables >pre- >date SQL). Even SAS data sets are referred to as tables. This made the >student apoplectic. I find a visual works well here. If you show a grid with rows and columns, then you can show a picture of a SAS data set and a SQL table and a lookup table, and show that (regardless of terminology and buzzwords) they're all pr...

From table to table....
I want to create a new table containing only the results from a select statement of another table. How is that done? select a, b, c into destTable from sourceTable where a='x' or a='y' or a='z'; Does one have to create the destTable or is it created for you with the correct structure? Can the rows of one table be used in the select of another table? eg: The above select statement has three choices. could those 'choices' have been rows of a column of a table? On Wed, 1 Feb 2012 10:29:45 -0800 (PST), SpreadTooThin wrote: > I want to create a new table co...

Table of tables
Given t = {{{-1, -1, -2+2I}, {-1, -1, 3-I}}, {{-1, -1, 4+I}, {-1, -1, -5-5I}}}; how can I extract the imaginary part of the complex elements to obtain {{{-1, -1, 2}, {-1, -1, -1}}, {{-1, -1, 1}, {-1, -1, -5}}}; thank you. Luiz Melo -- On Oct 20, 1:07 am, Luiz Melo <luiz.m...@polymtl.ca> wrote: > Given > > t = {{{-1, -1, -2+2I}, {-1, -1, 3-I}}, {{-1, -1, 4+I}, {-1, -1, -5-5I}}}; > > how can I extract the imaginary part of the complex elements to obtain > > {{{-1, -1, 2}, {-1, -1, -1}}, {{-1, -1, 1}, {-1, -1, -5}}}; > > thank yo...

Re: TABLES TABLES TABLES #5
LOL -- I told him I had a table in my dining room, and another kind in my kitchen, etc. -----Original Message----- From: Ed Heaton <EdHeaton@westat.com> To: Howard Wood <sasbum@AOL.COM> Sent: Mon, 28 Nov 2005 08:44:38 -0500 Subject: RE: TABLES TABLES TABLES Howard, Maybe you should turn the tables on him and correct him whenever he refers to a sedan as a car or to beef as meat or to an engine as a motor. Ed Ed Heaton RW-4541 #4818 -----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of Howard Wood Sent: Saturday, Nov...

Re: TABLES TABLES TABLES #6
Ahhhh - I'm lovin' that one. TY TY In a message dated 12/1/2005 6:14:05 AM Eastern Standard Time, rdevenezia@WILDBLUE.NET writes: Friar Broccoli wrote: > Try this (a higher authority): > > http://www.google.com/search?num=100&hl=en&lr=lang_en&safe=off&as_qdr=all&q=de fine%3A+data+table&btnG=Search&lr=lang_en > > Howard Wood wrote: >> OHHH went there, did that, got the t-shirt, even. I tried >> everything in the book. This person is extremely LITERAL and >> looking for the letter of the law, or something........maybe...