GNOME Bugzilla – Bug 611633
In LaTeX export multirow cells are not hyphenated
Last modified: 2010-03-04 07:30:43 UTC
Created attachment 155062 [details] Gnumeric file with multirow cell I attach a gnumeric file with the multirow cell A2. Export file as (full) LaTeX After compiling the file, cell A2 appears on the output shifted to the right and that might explain why the lines are split. Using smaller columns, though they fit into the LaTeX text width, it works perfectly: cell A2 appears like cell A1. The inner tabular environment (inside the \multirow command) could use @{} at the beginning and the end of its declaration for removing tabcolsep space. <snip from generated file> \multirow{2}[1]*{\begin{tabular}{@{}p{ \gnumericColA+% 0pt}@{}}\gnumericPB{\raggedright}aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aa <snip> Unfortunately, that's only one part of the problem. With this correction, cell A2 moves to the left, but nevertheless breaks wrong. Looks like wrong column width.
I don't see a problem. We do not export the font information. In LaTeX you are likely intending to use better fonts. So the cells that are setup to wrap automatically will of course break at different places. The slight shift for A2 comes from the need to insert a tabular environment. I don't know why that column is narrower considering that we specify in the LaTeX file that that cell should have the same width as the coulumn. columns: \begin{longtable}[c]{% b{\gnumericColA}% b{\gnumericColB}% } this row: \multirow{2}[1]*{\begin{tabular}{|p{ \gnumericColA+% 0pt}|}\gnumericPB{\raggedright}aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa \end{tabular}} &\gnumericPB{\raggedright}bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb If you think that we should be creating different LaTeX code please tell us, what you would expect to see!
Oh yeah: the obvious way of writing the second row would be: \multirow{2}{\gnumericColA}{\gnumericPB{\raggedright}aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa } &\gnumericPB{\raggedright}bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb but for some reason unkown to me, that doesn't work.
Cell A1 and A2 contain the same content. I would expect, that they wrap identical, if there are no font changes in between. Gnumeric does so with its font. LaTeX does so with its font, if both columns are smaller. LaTeX breaks at another point than Gnumeric, of course. But the LaTeX export from the attached file shows different behaviour: Cell A1 is wrapped at another point than A2. The tabular environment is a fine idea. But a tabular has small inner-column-spaces (\tabcolsep), as default. In global calculating column widths, you subtract their influence for fitting into the LaTeX text width. With the intention of using the same column width inside the multirow-cell, you have to remove this inner-column-spaces. That is done with @{} at the beginning and the end of the tabular definition, like shown in my previous description. Implementing the two occurances of @{}, you get a different output. But nevertheless, it doesn't solves the problem, why cell A2 is wrapped at another point than A1. It seems to be smaller, but which code is responsible for it? Why does it work with smaller columns, that fit into text width? Do you need the compiled PDF, showing the problem?
I have no doub tthat there are differnces between a PDF file created from Gnumeric and one created via LaTeX. It there weren't ther would be no point in this LaTeX output. So seeing a pdf file is pointless. Adding those @{} would be simple but as you point out they stil don't fix your issue. So the real question is, how would you like to see the LaTeX code change. As far as I can tell, the cell and the column both have column widths of \gnumericColA.
Created attachment 155102 [details] Adjusted LaTeX export sample file This file shows the adjusted export of a file (similar to the provided gnumeric file but with an additional empty multirow cell).
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Thank you for this quick fix. Your changed file works fine. I applied the patch to my current gnumeric (1.9.18). Unfortunately, multirow cells of my original document, which is more complex, now aren't wrapped using hyphenations. I again attach a gnumeric file, which shows the difference between cell A1 (wrapping with hyphenation) and cell A2 (wrapping without hyphenation), when compiling the LaTeX export with pdflatex (or similar). Maybe, it could be fixed, re-introducing the tabular environment inside the \multirow command: \multirow{2}[1]{\gnumericMultiRowLength}{% \begin{tabular}{@{}p{\gnumericMultiRowLength}@{}} \gnumericPB{\raggedright}tabulator tabulator/tabulator/environmental/tabular\end{tabular}} &\gnumericPB{\raggedright}bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb \\
Created attachment 155133 [details] Gnumeric file with multirow cell, hyphenation failes in A2 Sorry, comment #7 came without attachment.
hmm I think there must be a more reasonable way to tell LaTeX to hyphenate then to wrap each multirow into a tabular environment.
I suspect that it may suffice to add a \renewcommand{\multirowsetup}{} in the preamble of the document. I will test later.
\renewcommand{\multirowsetup}{} does not work. So we need to wrap the content, but wrapping in parbox is simpler. This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Thank you. All works fine now. It is a pretty nice function.
You are welcome. We aim to please.