2

I am using listing

\lstset{language=Matlab,%
    %basicstyle=\color{red},
    breaklines=false,%
    morekeywords={matlab2tikz},
    keywordstyle=\color{blue},%
    morekeywords=[2]{1}, keywordstyle=[2]{\color{black}},
    identifierstyle=\color{black},%
    stringstyle=\color{mylilas},
    commentstyle=\color{mygreen},%
    showstringspaces=false,%without this there will be a symbol in the places where there is a space
    numbers=none,%
    numberstyle={\tiny \color{black}},% size of the numbers
    numbersep=1pt, % this defines how far the numbers are from the text
    emph=[1]{for,end,break},emphstyle=[1]\color{red}, %some words to emphasise
    %emph=[2]{word1,word2}, emphstyle=[2]{style},    
}

and

  \begin{lstlisting}[frame=single]
for j=1:100:
    j
end
  \end{lstlisting}

I have three problems: 1) How do I remove the black box around the code? 2) How can I reduce interline in the code? 3) How can I copy-paste from my matlab code without loosing indentation? Because if I paste in my editor they start all from the same point and it's ugly

  • remove frame=single if you don't want a frame, 3) is an editor-specific problem. TeXshop, at least, didn't modify your example when I pasted it in. For 2), are you talking about interline spacing? Mine looks like normal single-spaced text and reducing it might cause overlap.
  • – Mike Renfro Sep 28 '16 at 21:50
  • 2
  • Welcome to TeX.SX! Can you please expand the code snippets that you have posted to a full minimal working example. It is much easier to help you you if we can start with some compilable code that illustrates your problem. A MWE should compile and be as small as possible to demonstrate your problem. –  Sep 28 '16 at 23:46