2

In the following MWE, which I believe works fine with xelatex, I observe a blank space where I'm trying to insert a nested table. I don't see any warnings or errors in the log file.

Are there any necessary patches I need to apply to properly display the nested tables?

While my final compile command is far more complex and makes use of much more of make4ht's capabilities my issues can be obtained by compiling with the following make4ht command line: make4ht.exe -u --format "odt" "file.tex"

\documentclass{article}

\begin{document}

Test

\begin{tabular}{l l }
    A1 & B1 \\ 
    A2 & B2 \\ 
    A3 & B3 \\ 
\end{tabular} 

\begin{tabular}{ l l} 
    \hline
    Outer column & Detail column\\ 
    \hline      

    a & 
    \begin{tabular}{l l }
        A1 & B1 \\ 
        A2 & B2 \\ 
        A3 & B3 \\ 
    \end{tabular} 
    \\
    \hline
    b 
    & 
    \begin{tabular}{l l }
        A1 & B1 \\ 
        A2 & B2 \\ 
        A3 & B3 \\ 
    \end{tabular} 
    \\
    \hline
    d & etc \\
    \hline
\end{tabular}

\end{document}
EngBIRD
  • 3,985

1 Answers1

3

The issue in this case is that the nested table is inserted inside a paragraph, which results in a non-valid ODT file. The inserted paragraph is hardwired in the configuration for table borders, so the usual paragraph blocking commands (\IgnorePar, \EndP) that are used in the tabular configuration don't work.

Fortunately, we can use a make4ht build file to post-process the XML file and remove the paragraphs:

-- build.mk4
local domfilter = require "make4ht-domfilter"
local process = domfilter {
function(dom)
  for _,table in ipairs(dom:query_selector("text|p table|table")) do
    -- replace the paragraph by its child element
    local parent = table:get_parent() 
    parent:replace_node(table)
  end
  return dom
end
}

Make:match("4oo$", process)

Save it as build.mk4 and execute the command:

 make4ht -uf "odt" -e build.mk4 "file.tex"

result:

enter image description here

michal.h21
  • 50,697