elsevier icon indicating copy to clipboard operation
elsevier copied to clipboard

5p layout not correctly rendered when table is added

Open SHolm3s opened this issue 1 year ago • 11 comments

Hi, I am using the elsevier quarto extension for a paper I am writing. When I add a markdown table, the 5p format is not rendering correctly. It is fine without the table, but with the table, some of the text in the beginning is cut off.

This is the render from the template file : image

Now when I just replace the content under the heading "Tables coming from R" with my own markdown table, I get this render: image

Everything above "Using CSL" is cut off! Could you help see why this is happening?

SHolm3s avatar Apr 02 '24 23:04 SHolm3s

This format should be trying to do the right thing with long tables in 2-column layouts, but I've seen when that code isn't working properly (e.g. before I added it).

I think a place to start is to add keep-tex: true to your document front matter, then inspect the latex that is produced to see whether we're correctly injecting the table handling.

We're basically hoping that this:

\usepackage{float}
\makeatletter
\let\oldlt\longtable
\let\endoldlt\endlongtable
\def\longtable{\@ifnextchar[\longtable@i \longtable@ii}
\def\longtable@i[#1]{\begin{figure}[H]
\onecolumn
\begin{minipage}{0.5\textwidth}
\oldlt[#1]
}
\def\longtable@ii{\begin{figure}[H]
\onecolumn
\begin{minipage}{0.5\textwidth}
\oldlt
}
\def\endlongtable{\endoldlt
\end{minipage}
\twocolumn
\end{figure}}
\makeatother

makes it into the latex.

One other thought- it's possible that since this is redefining longtable, if R/Quarto isn't producing longtables this may no longer be working. I know that we did a lot of work in this area for 1.4 (to make tables in LaTeX far more stable and reliable), so this is a real possibility. CC'ing @cscheid just in case he knows this off the top of his head.

dragonstyle avatar Apr 03 '24 00:04 dragonstyle

Thanks for the suggestion! I will see if I see it in the latex file and report back

SHolm3s avatar Apr 03 '24 00:04 SHolm3s

Hi, I checked the latex file, and the code that you mentioned is present in the generated latex. The top part is still cut off though

SHolm3s avatar Apr 03 '24 02:04 SHolm3s

Can you share the latex (or see whether the table in the document is a ‘longtable’)?

dragonstyle avatar Apr 03 '24 02:04 dragonstyle

I am attaching the latex file. I think I saw "longtable" at the end, longtable_cuts_off_text.txt

Thanks a lot for taking the time to help!

SHolm3s avatar Apr 03 '24 02:04 SHolm3s

Yeah it definitely seems like everything should be working, but it sure looks like the table is evading our special handling. I'll need to try to drill into the LaTeX more carefully to diagnose what is happening...

dragonstyle avatar Apr 03 '24 12:04 dragonstyle

Can you provide a .qmd file that causes this as well as the latex file?

cscheid avatar Apr 03 '24 16:04 cscheid

I actually am using quarto from jupyterlab and rendering the .ipynb file. But I made a qmd file too just now. The problem persists. I am attaching the qmd code in txt file elsevier5p_tablecutoff_qmd.txt

SHolm3s avatar Apr 03 '24 17:04 SHolm3s

Hi, Any luck with the debugging process ? Also I wanted to ask an unrelated question. Is there any way to span a figure across the 2 columns in 5p or 3p ?

SHolm3s avatar Apr 13 '24 00:04 SHolm3s