I'd like to center (horizontally) the lstlisting environment in the page. I tried using "xleftmargin=0.2\textwidth" but the result is not that satisfying. I tried to include the lstlisting env in a center env (parent-child), but it doesn't work. I even tried including lstlisting in a figure env, then \centering and then the lstlising, but this didn't work too.
I looked at several posts, especially this one, but the given solution is not actually working for me. I'll leave the code I wrote down.
\documentclass{article}
\usepackage{listings}
\begin{document}
\lstset{frame=none,
language=SQL,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\bfseries,
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
tabsize=4,
captionpos=b
}
\begin{lstlisting}
create table Student
(
Number char(16) primary key,
Name varchar(30),
Surname varchar(30)
)
\end{lstlisting}
\end{document}
I also noticed that without specifying any "tabsize" value, it gets centered automatically, but I really need that value for tabsize.