4
votes
1answer
94 views

lstlistings works strangely

I have some Java source code and want to display it in LaTex: \lstset{language=Java} \begin{lstlisting} IntentFileter intentfilter = new IntentFilter(); ...
7
votes
1answer
120 views

Display of source code in customised (IDE-like) format in PDFLaTeX

I want to put some “C” source code snippets in latex (I am using PDFLaTeX), but I don’t get the result that I want using the “listings” package. What ideally would like to get is the same result as ...
2
votes
1answer
55 views

Add coloring rules for specified language keywords in lstinputlisting [duplicate]

I would like to add coloring definition for e.g. @Override in java files. How can I do that ? So far I have the following coloring definitions : \documentclass[a4paper,11pt]{article} ...
1
vote
0answers
183 views

Make arrows inside lstlisting

Inside my lstlisting environment I want to make the assignment symbol an arrow instead of =. How can I do that? Adding just \leftarrow doesn't work, because then the whole word is displayed.
6
votes
2answers
273 views

How to put source code in a LaTeX table?

I am comparing source in a paper and I would like to put them in a table, so the differences are easily spotted. I used the following LaTeX code: \begin{tabular}{ | l | l | l |} Option 1 & ...
2
votes
1answer
130 views

Adding caption and counter to source code environment

I have a source code listing with minted environment. How can I make a counter/caption to be shown as follows. I also need to make \tableofsourcecode to enlist all the source code references. The ...
2
votes
1answer
127 views

Handle % character in verbatim inside a grey box

I found this snippet on the internet which is used to produce a text area inside a greybox. \newcommand\greybox[1]{% \vskip\baselineskip% \par\noindent\colorbox{lightgray}{% ...
6
votes
1answer
210 views

Including LaTeX documentation as comments in source code

I am working on a large C# project (hundreds of source files). I am trying to add documentation on various user inputs and options. For maintainability I would ideally like to be able to write the ...
3
votes
1answer
2k views

lstlisting line wrapping

How is it possible to let lstlisting wrap lines? I've troubles with following block: \begin{lstlisting}[language=java] public class MeasureStationControllerV0Test { MeasureStationControllerV0 ...
3
votes
2answers
174 views

Overbrace in lstlisting of Scala code

I want to add an overbrace to some text in a Scala code listing (using lstlisting). \begin{lstlisting} object TypeClass extends FooParMain { def newApp(args: Array[String]) = new FooParApp { ...
3
votes
0answers
168 views

Regular expressions in listings [closed]

I'm looking for a possibility to use regular expression in listings. I'd like to highlight each N thats followed by 4 decimal numbers for example N1234. How can I achieve that? Here is an example: ...
1
vote
0answers
76 views

spacing before scope resolution operator [closed]

I'm new to LaTeX and I have encountered a problem with the listings package, I have a space before the :: operator of C++ . after reading lstlisting with c++: spaces around scope resolution operator ...
1
vote
1answer
164 views

Displaying (source)Code in research article [duplicate]

I have this urgent need to display two pieces of code side by side for comparison in my article. Displaying a code, I've couple of requirement Should indent properly Output should be syntax ...
4
votes
1answer
373 views

Creating a table around a java script code highlighted using minted

I would like to create a block around javascript code in latex. I use minted package for format highlighting. Here is my example code: \documentclass[]{article} \usepackage{minted} %opening ...
6
votes
1answer
495 views

Enforce a line-break inside \lstinline

I use \lstinline{foo} from the listings package to set pieces of code in regular text. To get automatic line-breaks I use the following options: \lstset{ breaklines=true, breakatwhitespace=true, ...
6
votes
2answers
282 views

Comparing two versions of programming code with LaTeX

I'd like to compare two versions of program with vertical line between them. How can I do this with LaTeX?
0
votes
1answer
151 views

Question about ArsClassica codes

I would to know for what is used the code below (Last lines code) in arsclassica.sty. Also I would to know why in arsclassica-settings there are some repetitions of \lstset is not the same thing put ...
1
vote
1answer
474 views

How to write program text in table

I have to write a table with two columns and in each column I have to place small C code snippets. Using the \code{} in each column seems to be very tedious because I have to write \code{} in each ...
8
votes
3answers
4k views

How to put C++ source code into beamer slides [duplicate]

Possible Duplicate: How display LaTeX code in LaTeX document? How do I fit java style source code in one frame in beamer? How do I add C++ formatted and coloured source code to my beamer ...
6
votes
1answer
472 views

How to Format C Program Code Block Nicely

I am using the following settings to format my code blocks: % xxxxxxxxxxxxxxxxxxxxxxxxx Code Snippet STARTS xxxxxxxxxxxxxxxxxxxxxx \lstset{ language=C, % choose the language of ...
3
votes
1answer
285 views

Background images for code listings in beamer

I asked this question originally in attempt to get background images behind my code listings. Background images for code listings What I did not mention is that I am using the beamer package for ...
3
votes
1answer
721 views

Alternative way to print source code [duplicate]

Possible Duplicate: Syntax Coloring in LaTeX I want to add source code of my program in document but verbatim really bugs me. All that ugly fonts and stuff.
2
votes
1answer
283 views

treating multiple code listings as one figure (listings package)

Please note that I am quite new to tex/latex. For my paper I need to reference specific parts of my source code as one code listing. This allows me to skip specific lines of the source code that are ...
5
votes
1answer
2k views

Is there a good definition for highlighting PHP code in listings?

Does someone have a good definition for highlighting PHP code with the listings package?
4
votes
2answers
376 views

Problems When Escaping from Listings

I would like to use LaTeX to document my C++ code, since I am able to typeset mathematics easily, as well as create diagrams using TikZ. I made a minimal LaTeX template for testing, but I have already ...
1
vote
3answers
1k views

lstlisting with c++: spaces around scope resolution operator

I am having a hard time to make the output of lstlisting for c++ source look good. Currently, I am stuck with a problem to reduce the amount of space around the scope resolution operator ::. See the ...
4
votes
1answer
423 views

Beamer: How to do src highlighting when src is split with \only<> command? [duplicate]

Thanks to Marc van Dongen there is a template of a "step by step" programming tutorial (with a sample layout in his question): How to create step by step annotated programming tutorial in LaTeX? . I ...
7
votes
1answer
235 views

How would I recursively add the document source code to an appendix?

For kicks, I would like to include the source code as an appendix. It's rather superfluous, yes, but it's puzzling. I commonly have documents that are structured thusly: main.tex includes: ...
1
vote
1answer
153 views

Listing not printing inside “ ” [duplicate]

Possible Duplicate: Listings package not correctly showing PHP strings I'm using listings to include C code, but I've a problem: when I insert in the listing a printf like the following ...
2
votes
1answer
3k views

lstlisting environment ignores tabs

I have this LaTeX code: \lstset{ language=Java, tabsize=8, keepspaces, extendedchars=true, rulecolor=\color{black}, basicstyle=\footnotesize, aboveskip=5pt, ...
15
votes
2answers
2k views

Colored background in inline listings

I would like to make inline code more distinguishable from the text surrounding it, and I thought that using a background might work (like it is done on the stackexchange pages.) Since I use the ...
9
votes
1answer
6k views

How to create beamer slides with source code that can be copied?

We are converting our course slides from Powerpoint to LaTeX, to be able to offer all code in a more open format and to let students easily copy code from the slides. However, the latter does not seem ...
11
votes
3answers
4k views

How display LaTeX code in LaTeX document?

I'm making Beamer presentation. How I can display LaTeX code inside presentation?