An Option Clash When Using LaTeX Packages xcolor and showframe Simultaneously

Jan. 05, 2025

If we import \usepackage{showframe} first and then \usepackage[x11names]{xcolor}:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
\documentclass[a4paper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{lipsum}

\usepackage{showframe}
\usepackage[x11names]{xcolor}
\pagecolor{AntiqueWhite1}

\begin{document}
\vspace*{\fill}

\lipsum[1-2]

\vspace*{\fill}
\end{document}

an option clash error will occur:

1
2
line 7: Option clash for package xcolor. \pagecolor
line 7: Package xcolor Error: Undefined color `AntiqueWhite1'. \pagecolor{AntiqueWhite1}

This error is caused by the x11names option of xcolor package.

Conversely, if we change the order of the both:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
\documentclass[a4paper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{lipsum}

\usepackage[x11names]{xcolor}
\usepackage{showframe}
\pagecolor{AntiqueWhite1}

\begin{document}
\vspace*{\fill}

\lipsum[1-2]

\vspace*{\fill}
\end{document}

the file will be compiled normally:

img-1