我尝试在文档中添加 SQL 代码。我使用了以下代码。
\documentclass[12pt]{article}
\usepackage{amsmath, amssymb,amsthm,verbatim}
\usepackage{color}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{textcomp}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{HTML}{C42043}
\definecolor{backcolour}{HTML}{F2F2F2}
\definecolor{bookColor}{cmyk}{0,0,0,0.90}
\color{bookColor}
\lstset{upquote=true}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{codepurple},
numberstyle=\numberstyle,
stringstyle=\color{codepurple},
basicstyle=\footnotesize\ttfamily,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=10pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
}
\lstset{style=mystyle}
\title{SQL }
\begin{document}
\maketitle
\begin{lstlisting}[ language=SQL,
deletekeywords={IDENTITY},
deletekeywords={[2]INT},
morekeywords={clustered},
framesep=8pt,
xleftmargin=40pt,
framexleftmargin=40pt,
frame=tb,
framerule=0pt, ]
SELECT
LOCATION, COUNT(EMP_ID) AS Count_of_Employees
FROM
DEPARTMENT
FULL OUTER JOIN
EMPLOYEE ON DEPARTMENT.DEPT_ID = EMPLOYEE.DEPT_ID
GROUP BY DEPARTMENT.LOCATION
ORDER BY DEPARTMENT.LOCATION
;
\end{lstlisting}
\end{document}
尽管 PDF 正在生成,但我收到以下错误。
! Undefined control sequence.
\lst@numberstyle -> \numberstyle