multiple authors, math in tabular (was RE: [l2h] tabularx problem

Knut Franke knut.franke@gmx.de
Tue, 21 May 2002 00:26:49 +0200


Joachim Schlosser wrote

>Okay, possibly the explanation was a bit too short. When I have a
>\author{My Name\\My Company \and Another Name\\Another Company \and Yet
>Another Name\\Yet Another Company}
>in DVI it shows up as
>
> My Name      Another Name        Yet Another Name
>My Company   Another Company    Yet Another Company
>
>whereas in l2h it produces
>
>My Name
>My Company - Another Name
>Another Company - Yet Another Name
>Yet Another Company
>
>As this is not the correct behavior, I suppose this might be a bug.
>
The author-handling code indeed seems to have been written.with a single 
document author in mind.
At least not with multiple author-parts spanning over several lines each.
I still don't know where the \and gets translated to a '-', so maybe I 
missed something.

As long as you use neither amsmath nor the \authorURL command, the 
following patch produces a DVI-like result.
I hope you are using v1.68, too...

-------------------------------------- snip 
--------------------------------------
--- latex2html.old
+++ latex2html
@@ -2241,7 +2241,7 @@
     # These filenames may be set when translating the corresponding 
commands.
     local($tocfile, $loffile, $lotfile, $footfile, $citefile, $idxfile,
       $figure_captions, $table_captions, $footnotes, $citations, 
%font_size, %index,
-      %done, $t_title, $t_author, $t_date, $t_address, $t_affil, $changed);
+      %done, $t_title, @t_authors, $t_date, $t_address, $t_affil, 
$changed);
     local(%index_labels, %index_segment, $preindex, %footnotes, 
%citefiles);
     local($segment_table_captions, $segment_figure_captions);
     local($dir,$nosave) = ('','');
@@ -12261,9 +12261,12 @@
     (s/$next_pair_pr_rx/$next = $&;''/seo)
     ||(s/$next_pair_rx/$next = $&;''/seo));
     local($after) = $_;
-    $_ = &translate_environments($next);
-    $next = &translate_commands($_);
-    ($t_author) = &simplify($next);
+    local(@authors) = split(/\\and/, $next);
+    foreach $next (@authors) {
+    $_ = &translate_environments($next);
+    $next = &translate_commands($_);
+    push(@t_authors, &simplify($next));
+    }
     $after;
 }
 
@@ -12342,15 +12345,20 @@
     if ($t_title) {
     $the_title .= "<H1$alignc>$t_title</H1>";
     } else { &write_warnings("\nThis document has no title."); }
-    if ($t_author) {
-    if ($t_authorURL) {
-        local($href) = &translate_commands($t_authorURL);
-        $href = &make_named_href('author'
-                 , $href, "<STRONG>${t_author}</STRONG>");
-        $the_title .= "\n<P$alignc>$href</P>";
-    } else {
-        $the_title .= "\n<P$alignc><STRONG>$t_author</STRONG></P>";
-    }
+    if ($t_authors[0]) {
+#    if ($t_authorURL) {
+#        local($href) = &translate_commands($t_authorURL);
+#        $href = &make_named_href('author'
+#                 , $href, "<STRONG>${t_author}</STRONG>");
+#        $the_title .= "\n<P$alignc>$href</P>";
+#    } else {
+        $the_title .= "\n<CENTER><TABLE><TR>\n";
+        local($author);
+        foreach $author (@t_authors) {
+        $the_title .= "<TD 
ALIGN=\"CENTER\"><STRONG>$author</STRONG></TD>\n";
+        }
+        $the_title .= "</TR></TABLE></CENTER>\n";
+#    }
     } else { &write_warnings("\nThere is no author for this document."); }
     if 
($t_institute&&!($t_institute=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
         $the_title .= "\n<P$alignc><SMALL>$t_institute</SMALL></P>";}

-------------------------------------- snap 
--------------------------------------

amsmath.perl, amstex.perl and the \authorURL-Code in latex2html would 
have to be changed accordingly.
These changes are *not* included in the patch above.

@Ross:
Sorry for dissecting the main program again. I know there are other ways 
around the problem, but this would
mean either overwriting sub translate in .latex2html-init or supplying 
two different versions of the \author command
in the LaTeX file, which is both not the way I think this should be handled.

Knut