I added \definecolor{bg}{HTML}{282828} to my .tex file and now latex --shell-escape file.tex is breaking with less-than-helpful error messages.

File.tex looks like:




(note my shell script changes {filetype} and {example} to appropriate values)

The error message says

! Undefined control sequence.
l.5 \definecolor

! LaTeX Error: Missing \begin{document}.

But as you can see \begin{document} is not actually missing.

I see lots of other questions about "undefined control sequence" but don't understand what it's actually about nor what it means in this context.


An "undefined control sequence" means you're using a control sequence (or macro) that doesn't exist. \definecolor is defined within the color package. It's included when using xcolor. So, add \usepackage{xcolor} to your preamble before using \definecolor:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.