1

With the following code:

\documentclass[twocolumn,11pt]{article}
\usepackage{lipsum}
\usepackage{color}
\definecolor{mygreen}{RGB}{28,172,0}
\definecolor{mylilas}{RGB}{170,55,241}
\usepackage{listings}
\lstset{language=Matlab,
    basicstyle=\small,
    breaklines=true,
    morekeywords={matlab2tikz},
    keywordstyle=\color{blue},%
    morekeywords=[2]{1}, keywordstyle=[2]{\color{black}},
    identifierstyle=\color{black},%
    stringstyle=\color{mylilas},
    commentstyle=\color{mygreen},%
    showstringspaces=false,%
    numbers=left,%
    numberstyle={\tiny \color{black}},% size of the numbers
    numbersep=9pt, % this defines how far the numbers are from the text
    emph=[1]{for,end,break},emphstyle=[1]\color{red},
}

\begin{document}
    \lipsum[1-2]
    \lstinputlisting{GiveMeAnAnswerPlease.m}
\end{document}

The code come from this answer. Here the output: the output Unfortunately line numbering overlays the first column. Is it possible to shift the line numbering?

0

1 Answer 1

2

You can set for example

xleftmargin=2em

in the \lstset command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .