6

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:

\documentclass[varwidth=40cm,border=2mm]{standalone}

\usepackage{minted} \usemintedstyle{solarized} \definecolor{bg}{HTML}{282828}

\begin{document} \begin{LARGE} \inputminted{filetype}{example} \end{LARGE} \end{document}

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

The error message says

! Undefined control sequence.
l.5 \definecolor
                {bg}{HTML}{282828}
?

! 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.

Werner
  • 603,163
alec
  • 215

1 Answers1

11

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:

%...
\usepackage{xcolor}
\definecolor{bg}{HTML}{282828}
%...
Werner
  • 603,163
  • "Control sequence is (typically, roughly speaking) a sequence of letters with preceded backslash" from https://tex.stackexchange.com/questions/242053/what-is-a-control-sequence – alec Jan 24 '21 at 12:54