5

I've just updated all packages from CTAN and my articles in RevTeX style stopped compiling. Digging down, I've narrowed it to the use of p column type (and its derivatives), used to make a text-filled table cell with word wrap. This used to compile just fine under RevTeX, but now it generates lots of errors and prevents it from producing output at all.

This seems to be not caused by changes in the current RevTeX 4-2, but by some other package update incompatible with it. I have a legacy RevTeX 4-1 manually installed on my machine, not updated for years and no longer in CTAN. That old style also stopped compiling after the recent package update, with the same bunch of errors.

Here are minimal examples. This one compiles without errors:

\documentclass{article}
\usepackage{array}
\begin{document}
\begin{table}
        \begin{tabular}{p{30mm}}
        \hline\hline
This text needs to be wrapped inside the table cell. This text needs to be wrapped inside the table cell. This text needs to be wrapped inside the table cell.\\
        \hline\hline
        \end{tabular}
\end{table}
\end{document}

This one fails with errors:

\documentclass[aps,pra,twocolumn,showpacs,amsmath,amssymb,preprintnumbers,superscriptaddress,10pt]{revtex4-2}
\usepackage{array}
\begin{document}
\begin{table}
        \begin{tabular}{p{30mm}}
        \hline\hline
This text needs to be wrapped inside the table cell. This text needs to be wrapped inside the table cell. This text needs to be wrapped inside the table cell.\\
        \hline\hline
        \end{tabular}
\end{table}
\end{document}

I contacted APS helpline but they were not helpful to track down the cause of the problem and did not suggest workarounds.

I just need to be able to wrap text inside table cells in RevTeX. Package makecell still works, but I would prefer automatic text wrap, not manual line breaks.

11
  • Welcome to TeX.SE.
    – Mico
    Commented Nov 28 at 19:34
  • Are you sure the compilation problems are related to the use of the p column type in a tabular environment? The reason I ask is that I get the exact same problems with your setup and with just the word "Hello" in the body of the document. The error message i get is triggered by LaTeX encountering the instruction \begin{document}: ! Extra \endgroup. \document ->\endgroup \document@inithook \true@sw {} \UseOneTimeHook {begindo... I use MacTeX2024 with all updates applied.
    – Mico
    Commented Nov 28 at 19:37
  • Test of your MWE gives the same errors with recent version of the MiKtEX. However, if I remove array package from loading in preamble, compilation go fine. This can be explained, that documentclass has own codes for tabular column types, which should not be overwritten by loading array package,
    – Zarko
    Commented Nov 28 at 20:01
  • 1
    You may try to use tabularray package. I supports all features of packages which you use in your document and works fine with revtex document class.
    – Zarko
    Commented Nov 28 at 20:47
  • 1
    Second part of my previous comment. This works fine: \documentclass[aps,pra,twocolumn,showpacs,amsmath,amssymb,preprintnumbers,superscriptaddress,10pt]{revtex4-2} \usepackage{tabularray} \begin{document} \begin{table} \begin{tblr}{hlines, colspec={Q[ wd=30mm]}} \hline\hline This text needs to be wrapped inside the table cell. This text needs to be wrapped inside the table cell. This text needs to be wrapped inside the table cell.\\ {A\\B}\\ \end{tblr} \end{table} \end{document}
    – Zarko
    Commented Nov 28 at 20:52

3 Answers 3

8

Until revtex is updated you can roll back array, for example this works

\documentclass[aps,pra,twocolumn,showpacs,amsmath,amssymb,preprintnumbers,superscriptaddress,10pt]{revtex4-2}
\usepackage{array}[=2016-10-06]
\begin{document}
\begin{table}
        \begin{tabular}{p{30mm}}
        \hline\hline
This text needs to be wrapped inside the table cell. This text needs to be wrapped inside the table cell. This text needs to be wrapped inside the table cell.\\
        \hline\hline
        \end{tabular}
\end{table}
\end{document}
1
  • Ah, I didn't try to roll back the package that far ... Commented Nov 28 at 21:15
8

Looks like revtex is heavily patching tabular it seems, but not really expecting that the core array package is loaded as an extension (which augments tabular). In fact it even says so (but only in the log):

Class revtex4-2 Info: Unrecognized array package. Please update this document c
lass! (Proceeding with fingers crossed.) on input line 7.

As always, patching internals not meant to be an interface is always dangerous and can cause failures if the internals changes. So by the end of the day, the maintainers of revtex would need to look at what they are patching and what needs to be altered to support array (and match the definitions in the more recent kernel of LaTeX).

What seems to work short-term for your paper (or at least for the example above) is adding

\RequirePackage[2024-06-01]{latexrelease}

\documentclass[aps,pra,twocolumn,showpacs,amsmath,amssymb,preprintnumbers,superscriptaddress,10pt]{revtex4-2}

i.e., reverting back to the kernel from LaTeX 2024-06. But of course long term that is not a viable solution and aps would either need to prohibit "array" or adjust their mods to the newer packages.

Haven't check what they change or why; normally, the inner working of something like tabular should not be altered imho.

Note

There was a statement in the comments that array should not overwrite what that class has altered, but that wrong: the class should not alter internals or if it does, it needs to be prepared update when there are changes to the internals. In addition, array is a core package of LaTeX which is augmenting the kernel and stays in snyc with it (in fact at some point it might move to the kernel), so any patching of internals would need to take into account that this package may get loaded.

But I guess the real cause is the added support for accessible PDFs as Ulrike mentioned. So if revtex wants to be able to produce accessible PDFs in the future it can't overwrite that or add stuff that breaks it (accessible PDFs always load array, which is why I mentioned it may move eventually in the kernel in some future release).

1
0

Neither solution that reverts to old versions works for me (I do not know why, they just generate errors).

I have re-done my tables using tabularray package, which is compatible with RevTeX. While it has been a hassle to reformat everything into a new syntax, I see how that package is better for typesetting complex tables. So, the time spent learning it has not been wasted.

2
  • 1
    I'm not sure why you are getting errors: I've just checked both suggested solutions and they run fine with your example - did you make sure to e.g. remove any auxiliary files first?
    – Joseph Wright
    Commented Nov 29 at 7:07
  • Yes deleting the auxiliary files helped with the minimum example, but not with my paper. It seems I have more than the array package there that is incompatible. Commented Nov 29 at 21:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .