\documentclass{article}
\usepackage[adobefonts]{ctex}
\usepackage[os=win]{menukeys}
\usepackage{listings}
\begin{document}
\end{document}
The simplest TeX file above cannot be compiled with xelatex
, the errors are:
(/opt/local/texlive/2014/texmf-dist/tex/latex/adjustbox/adjustbox.sty
(/opt/local/texlive/2014/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/opt/local/texlive/2014/texmf-dist/tex/generic/xkeyval/xkeyval.tex))
(/opt/local/texlive/2014/texmf-dist/tex/latex/adjustbox/adjcalc.sty)
(/opt/local/texlive/2014/texmf-dist/tex/latex/adjustbox/trimclip.sty
(/opt/local/texlive/2014/texmf-dist/tex/latex/collectbox/collectbox.sty)
(/opt/local/texlive/2014/texmf-dist/tex/latex/adjustbox/tc-xetex.def))
(/opt/local/texlive/2014/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty)
(/opt/local/texlive/2014/texmf-dist/tex/latex/varwidth/varwidth.sty))
(/opt/local/texlive/2014/texmf-dist/tex/latex/relsize/relsize.sty)
(/opt/local/texlive/2014/texmf-dist/tex/latex/catoptions/catoptions.sty)
(/opt/local/texlive/2014/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/opt/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(/opt/local/texlive/2014/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/opt/local/texlive/2014/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/opt/local/texlive/2014/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/opt/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ifluatex.sty)))))
(/opt/local/texlive/2014/texmf-dist/tex/latex/listings/listings.sty
(/opt/local/texlive/2014/texmf-dist/tex/latex/listings/lstmisc.sty)
(/opt/local/texlive/2014/texmf-dist/tex/latex/listings/listings.cfg))
(/opt/local/texlive/2014/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty
! LaTeX Error: Option clash for package xeCJK.
See the LaTeX manual or LaTeX Companion for explanation. Type H
<return> for immediate help. ...
l.44 \RequirePackage
{ listings }
?
What's the root cause?
Weird Phenomena: Each of the following three versions is OK.
Good Version 1:
\documentclass{article}
% \usepackage[adobefonts]{ctex}
\usepackage[os=win]{menukeys}
\usepackage{listings}
\begin{document}
\end{document}
Good Version 2:
\documentclass{article}
\usepackage[adobefonts]{ctex}
% \usepackage[os=win]{menukeys}
\usepackage{listings}
\begin{document}
\end{document}
Good Version 3:
\documentclass{article}
\usepackage[adobefonts]{ctex}
\usepackage[os=win]{menukeys}
% \usepackage{listings}
\begin{document}
\end{document}
h
to the prompt as it suggests (if you did it suggests a change to the document to avoid the error)menukeys
has nothing to do with it. But since it does some changes on how options are handled it is recommended to load it as last (one of the later) package(s).