make4ht icon indicating copy to clipboard operation
make4ht copied to clipboard

ODT How to color a row in odt output using Latex Tabular and longtable environment?

Open onekk opened this issue 10 months ago • 0 comments

I have tried to produce a table using this code:

\documentclass[a4paper]{article}
\usepackage[table]{xcolor}
\usepackage[T1]{fontenc}
\usepackage{array}
\usepackage{longtable}

\definecolor{lightgray}{gray}{0.75}
  
\begin{document}

Some text to make some text appear before the table.


\noindent
\begin{tabular}%
  {|>{\raggedright\arraybackslash}p{0.17\textwidth}%
  |>{\raggedright\arraybackslash}p{0.32\textwidth}%
  |>{\raggedright\arraybackslash}p{0.14\textwidth}%
  |>{\raggedright\arraybackslash}p{0.33\textwidth}%
  |}
  \hline
  \rowcolor{lightgray} \textbf{Field} & \multicolumn{3}{l|}{\bfseries File descriptor} \\
  \hline
  \textbf{Line1} & data1 & \textbf{Data2} & data2 \\
  \hline
  \textbf{Line2} & data1 & \textbf{Data2} & data2 \\
  \hline
  \textbf{Line3} & data1 & \textbf{Data2} & data2 \\
  \hline
  \textbf{Line4} & data1 & \textbf{Data2} & data2 \\
  \hline
\end{tabular}


Some text after the table


\end{document}

The example show 'tabular' environment, but it works in the same way if I put 'longtable' instead of 'tabular' when processing the file with lualatex producing this result:

Image

Using 'tabular' the produced odt file result is this:

Image

Note: green highlights are due to a selection in the pdf not a color in table cell

Using 'longtable' the table is absent from the odt file produced:

I use this script to compile:

#!/bin/bash

make4ht -f odt --lua -a debug longtable.tex "tikz+"

These are the information when compiling the file that should hopefully provide the versions of Tex installation used.

This is LuaTeX, Version 1.18.0 (TeX Live 2024)  (format=dvilualatex 2025.2.10)  15 FEB 2025 12:48
 restricted system commands enabled.
**\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCo
de"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.
{\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafte
r\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@
ifnextchar[{\HCode}{\documentstyle[tex4ht]}}\RequirePackage[#1,html]{tex4ht}}\m
akeatother\HCode xhtml,tikz+,charset=utf-8,ooffice.a.b.c.\input "\detokenize{lo
ngtable.tex}"
Lua module: luaotfload 2024-02-14 v3.28 Lua based OpenType font support
Lua module: lualibs 2023-07-13 v2.76 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2023-07-13 v2.76 ConTeXt Lua libraries -- extended collection.
luaotfload | conf : Root cache directory is "/home/carlo-dv/.texlive2024/texmf-var/luatex-cache/generic/names".
luaotfload | init : Loading fontloader "fontloader-2023-12-28.lua" from kpse-resolved path "/opt/texlive/2024/texmf-dist/tex/luatex/luaotfload/fontloader-2023-12-28.lua".
Lua-only attribute luaotfload@noligature = 1
luaotfload | init : Context OpenType loader version 3.134
Inserting `luaotfload.node_processor' in `pre_linebreak_filter'.
Inserting `luaotfload.node_processor' in `hpack_filter'.
Inserting `luaotfload.glyph_stream' in `glyph_stream_provider'.
Inserting `luaotfload.define_font' in `define_font'.
Lua-only attribute luaotfload_color_attribute = 2
luaotfload | conf : Root cache directory is "/home/carlo-dv/.texlive2024/texmf-var/luatex-cache/generic/names".
Lua-only attribute luaotfload.letterspace_done = 3
Inserting `luaotfload.aux.set_sscale_dimens' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.set_font_index' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.patch_cambria_domh' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.fixup_fontdata' in `luaotfload.patch_font_unsafe'.
Inserting `luaotfload.aux.set_capheight' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.set_xheight' in `luaotfload.patch_font'.
Inserting `luaotfload.rewrite_fontname' in `luaotfload.patch_font'.
Inserting `tracingstacklevels' in `input_level_string'.
(/opt/texlive/2024/texmf-dist/tex/generic/tex4ht/tex4ht.sty
version 2025-02-03-13:10
Package: tex4ht 

TIA and kind regards

Carlo D.

onekk avatar Feb 15 '25 11:02 onekk