Linked Questions

29
votes
2answers
68k views

How to add line numbers to a program listing/code? [duplicate]

How do I copy code in to latex to get a result which looks like this: ...Without the red bars of course. I don't know how to get the numbering on the left side when I compile LaTeX. Using \verbatim ...
8
votes
3answers
7k views

Putting in MATLAB codes in a box as figures? [duplicate]

how do I put MATLAB codes in a box or deal with them as if they are figures? Is there a way to do it within LaTeX itself? I am currently using the verbatim environment to present my codes and to be ...
7
votes
1answer
40k views

How to include Matlab code into LaTeX in colour? [duplicate]

I need Matlab code, e.g. the one here, in LaTeX and in colour (the comment is green, for/if/else/end is blue). % super cooles Programm i = 1 for i = 1:10 if i > 3 i=i+2 else ...
1
vote
2answers
14k views

MATLAB output into tex [duplicate]

Is there any way to import raw MATLAB output into .tex documents? I have already seen verbatim package as a solution, but it does not meet my demands for 2 reasons: Matrix elements are not aligned, ...
2
votes
2answers
8k views

What is the best way of including Matlab code in a LaTeX document? [duplicate]

I know this is a popular problem. I have read that the matlab-prettifier package yields good results. My Editor told me, I am missing this package, though. I don't know how to download the package to ...
1
vote
1answer
3k views

Need to show MATLAB code in TeX document, using pdfLaTeX [duplicate]

I am trying to make a simple document, showing MATLAB code, and some images. This is my template that I am using. \documentclass{article} \usepackage{graphicx} \usepackage{float} \usepackage{amsmath}...
62
votes
6answers
20k views

Syntax Coloring in LaTeX

Is there any way to include Python code in a LaTeX file and automatically color its syntax? Is it possible to do syntax coloring with any other language? If yes what packages can I use to do that?
35
votes
2answers
64k views

How to change listing caption?

I have some listings that contain pseudo-code of algorithms. And I use this: \lstset{caption={Descriptive Caption Text},label=DescriptiveLabel} to add captions to them. My problem is that the ...
39
votes
1answer
111k views

Bibliography not compiling

I have a latex file for my dissertation wherein I include several chapters. Everthing (\ref, figures) compiles file except my bibliography. Scouring the internet does me no help as this seems to be ...
15
votes
1answer
31k views

option clash for package xcolor [duplicate]

I'm trying to set some color on my caption like this \usepackage[svgnames]{xcolor} \usepackage[labelfont={color=red,bf}]{caption} But it gives me this error "option clash for package xcolor". But ...
15
votes
2answers
12k views

How to get caption above listing with minted?

I'm using the minted package. How can I get the caption to show before the code in the document? \documentclass[a4paper]{scrartcl} \usepackage{minted} \begin{document} \begin{listing}[H] \...
6
votes
3answers
1k views

How to highlight a portion of Matlab Code

Consider following code posted for What can I use to typeset MATLAB code in my document? \documentclass{article} \usepackage[T1]{fontenc} \usepackage{bigfoot} % to allow verbatim in footnote \...
13
votes
4answers
4k views

Problems with copy and paste from PDF using lstlisting

I'm using lstlisting to create course notes from which I am hoping that code can be copy&paste'd I've already implemented the suggestions in Phantom spaces in listings (pdf) to make sure that ...
9
votes
2answers
595 views

How to call a package added previously

I'm using the package mcode to show matlab code in my thesis. This package requires the xcolor package so it automatically loads it. My problem is that I have to call the table option in the xcolor ...
12
votes
1answer
25k views

Package listings: Error "Undefined control sequence." because of single-quote-symbol?

I'm using the package listings and came across a problem displaying an SQL statement within an java environment. This is the MWE. \documentclass[]{report} \usepackage{listings} \definecolor{...

15 30 50 per page
1
2 3 4 5
7