## Summary
When upgrading a document created with **LyX 2.4** that contains tables in a
**Beamer** document class, LyX 2.5 may generate LaTeX code that fails to
compile due to an undefined command `\SetKeys`.
The issue appears in **macOS + TeX Live**, but does not occur in **Windows +
MiKTeX** in my tests.
## Steps to Reproduce
1. Create a Beamer document in **LyX 2.4**.
2. Insert a simple table.
3. Save the file.
4. Open it in **LyX 2.5** and allow the format upgrade.
5. Compile using **pdflatex**.
Compilation fails with:
```
! Undefined control sequence.
\__hook_toplevel begindocument ->\SetKeys [xcolor]{table}
l.33 \begin{document}
```
## Generated LaTeX
The exported `.tex` file contains:
```latex
\AtBeginDocument{\SetKeys[xcolor]{table}}
\usepackage{colortbl}
```
However `\SetKeys` is not defined in this context.
## Observations
### Difference between new and upgraded tables
Tables created directly in **LyX 2.5** compile correctly.
Comparing the `.lyx` source shows that new tables include additional attributes
such as:
```
borderColor="default"
oddRowsColor="default"
evenRowsColor="default"
color="default"
```
while upgraded tables do not contain these attributes.
This suggests the issue may be related to the **new table color system
introduced in LyX 2.5**.
### Interaction with Beamer
The **Beamer** class already loads:
```latex
\usepackage{xcolor}
```
without the `table` option.
Trying to add
```latex
\usepackage[table]{xcolor}
```
causes an option clash.
Therefore the inserted command
```
\SetKeys[xcolor]{table}
```
fails because the required definitions are not available.
### Platform difference
Interestingly the problem **does not occur on Windows with MiKTeX**.
Exporting the `.tex` file there shows that the line
```
\AtBeginDocument{\SetKeys[xcolor]{table}}
```
is not inserted.
## Workarounds
### Compatibility definition
Adding the following to the document preamble avoids the error:
```latex
\providecommand{\SetKeys}[2][]{}
```
Since old tables do not use color features, this appears safe.
### Recreating the table
Creating a new table in LyX 2.5 and copying the content also resolves the
problem, because the new table includes the additional color attributes.
However this is impractical for documents containing many tables.
## Environment
Example failing environment:
LyX 2.5.x
macOS
TeX Live
pdflatexWorking environment: LyX 2.5.x Windows MiKTeX
beamer-ly24-pdflatex-upgrade-to-ly25.lyx
Description: beamer-ly24-pdflatex-upgrade-to-ly25.lyx
beamer-ly24-pdflatex.lyx
Description: beamer-ly24-pdflatex.lyx
-- lyx-devel mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-devel
