Tagged Questions
3
votes
1answer
31 views
Ugly spacing in lstinline
I am using the listings package to typeset Erlang source code in my thesis. For short snippets, I use \lstinline. The result is often unsatisfying. Consider the following example, which contains ...
2
votes
1answer
107 views
Syntax highlighting for different programming languages [duplicate]
In my paper I want to include some source codes with colored sytax. For syntax highlighting I use the listings package:
\lstset{frame=tb,
language={[Visual]Basic},
aboveskip=3mm,
belowskip=3mm,
...
1
vote
1answer
112 views
Highlighting a Chunk of Code within a lstlisting by specifying the line number
This question in somehow related to http://stackoverflow.com/questions/1304315/highlighting-a-chunk-of-code-within-a-lstlisting but not exactly the same.
I want to make some slides with animation ...
7
votes
1answer
190 views
Making Source Code Copyable with listings
I'm using listings to display some matlab code in my latex document but i'd like to have syntax highlighting. I've tried two ways of getting syntax highlighting and neither make the code copyable. The ...
0
votes
1answer
98 views
List a CMake file
Does anyone have/know of a style file for the listings package which would enable the correct syntax highlighting of cmake files in LaTeX?
7
votes
1answer
186 views
Highlighting double backslash using listings with texcsstyle
I've got a question (it's in the title) about listings that I do not believe have been answered anywhere (either that or my Google-fu isn't that sufficient). Before I knew of texcsstyle's star option, ...
1
vote
2answers
199 views
lstinputlistings syntax highlighting
I am using package listings to import my Python source code into my LaTeX document. I use the command \lstinputlistings. I have a Python source like
class MyClass(Yourclass):
def __init__(self, ...
3
votes
0answers
45 views
Highlighting keywords with spaces with the listings package [duplicate]
Possible Duplicate:
How to emphasize within a listing two successive identifiers separated by a space?
I am trying to highlight the following keywords with the listings package:
over ...
5
votes
0answers
277 views
Advanced use of listings package [closed]
I am a PhD student in A.I. that is using the listings package to render its code snippets.
I am trying to define a language environment for Drools - a quite famous Production Rules System - that is ...
2
votes
1answer
796 views
\lstdefinestyle syntax highlighting
I´m new to latex and got the following problem. I defined a listing style for XML Syntax highlighting like this:
How can I get also the equals symbol in the attribute color (orange)? I want to do ...
1
vote
1answer
276 views
\lstinputlisting for a normal text file?
sometimes im using \lstinputlisting to show some code examples in my pdf. Now I just would like to insert a normal textfile. Everything is fine, I like this box around my text and the numbers every ...
4
votes
1answer
128 views
Highlight a prompt with the listings package
I use the listings package to typeset a series of commands in the language Octave (a free clone of Matlab) in my lecture notes. Most of the command lines look like this:
octave:1> A=eye(4)
A =
...
5
votes
1answer
276 views
How to render Android listings with syntax highlighting?
I need to include the source code of a bigger Android project in the documentation written with LaTeX. Do you recommend any particular package that is capable of highlighting Java code and which also ...
4
votes
1answer
139 views
listings wrong syntax highlighting in perl - format specification
Perl uses '#' as an introduction for a comment, but also as a format specification. This produces problems in the syntax highlighting in the listings-package. How can I fix it?
...
5
votes
1answer
709 views
XML syntax highlighting does not work
How do I make comments highlighted in the form:
<!-- ======= Processing Root tag ======= -->
. This is not working.
\documentclass[11pt]{scrartcl}
\usepackage{listings, color}
...
0
votes
0answers
286 views
lstlisting does not match closing bracket “)” and morekeywords [closed]
i have the following Code:
\definecolor{dkgreen}{rgb}{0,0.39063,0}
\definecolor{gray}{rgb}{0.5,0.5,0.50}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{lines}{rgb}{0.00,0,0.50}
...
6
votes
1answer
408 views
C preprocessor commands in listings package
I am using the listings package, which is mostly formatting things nicely. However, it fails to syntax highlight indented preprocessor commands correctly.
For example,
\documentclass{article}
...
4
votes
1answer
445 views
Highlight certain texts in listings or minted [duplicate]
Possible Duplicate:
Manual highlight of TeX code in a verbatim environment
I want to highlight certain parts of a program output listing which represent user input. For example I want to ...
2
votes
1answer
3k 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}
...
3
votes
1answer
855 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?
3
votes
1answer
381 views
Beamer: How to do src highlighting when src is split with \only<> command?
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 ...
2
votes
1answer
455 views
Using “listings” package to colorize the source code of ANTLR grammar file?
I use listings package in my diploma thesis for source code. Besides the mainstream languages like Java and C# I also need to include the sources of the language grammars (.g) which are pure mark-up ...
4
votes
1answer
173 views
How to highlight a non-ascii keyword using the listings package?
I'm trying to highlight a couple of keywords which contain non-ASCII characters using the listingsutf8 package. This is the relevant part of my document:
\usepackage[brazilian]{babel}
...
3
votes
2answers
277 views
How to emphasize the character '&' within a listing?
How do I emphasize with the listings package the column separators in a tabular environment?
This is my MWE:
\documentclass{article}
\usepackage{lmodern}
\usepackage{graphicx}
...
2
votes
1answer
209 views
Force minted to insert new space in code that won't fit on the page
Essentially I would like to have listings' breaklines option on minted. I can't seem to find it. I could manually insert new lines but it becomes difficult when the code comes from an external file.
3
votes
1answer
1k views
Fortran syntax highlighting in listings
I've got some Fortran 90 source code I want to put into my thesis appendix. For this I'm using the listings package. Is it possible to have colored syntax highlighting for the Fortran code?
0
votes
1answer
292 views
Highlighting line ranges in listings
I've put here one adaptation for "no-beamer" documents of this code. Thanks a lot for the indications given below by Daniel.
% Sources :
% 1) ...
9
votes
1answer
558 views
Highlighting line ranges in a lstlisting: partial solution, but expansion issues
In my quest for a better solution for How to change appearance of a particular line when using \lstincludelisting, I came across the linebackground= option Martin Scharrer added to the listings ...
6
votes
1answer
554 views
How to redefine \lstinline to automatically highlight or draw frames around all inline code snippets?
How to redefine \lstinline to automatically highlight or draw frames around all inline code snippets? E.g. using \bh and \eh commands from Highlight text in code listing while also keeping syntax ...
3
votes
1answer
618 views
Listings package: how to suppress highlighting/emphasis on identifiers containing keywords?
I'm using the x86masm dialect of Assembler and register names are emphasized even when they occur inside of a label or a hexadecimal number. For example, dh is register, but 0dh is a number, yet the ...
2
votes
1answer
925 views
How to highlight own keywords in HTML lstlistings?
I would like to highlight some words in a lstlisting. The language is HTML.
However, \emph seems not to be working with HTML.
Any suggestions how I could work around this problem?
Right now I have:
...
3
votes
2answers
560 views
Emphasizing a string in code example using showexpl
I am writing documentation for a package using the showexpl package which in turn uses the listings package. When using listing I can highlight a portion of the code like this:
...
7
votes
1answer
606 views
listings package - Can I include a backslash \ in language keyword (\begin) for syntax highlighting in LaTeX code?
I want to highlight a LaTeX code (including backslash \, e.g. \begin). Unfortunately, by default a LaTeX listings package does syntax highlighting only keywords WITHOUT back slash (e.g. begin).
7
votes
1answer
591 views
Listings package: How to highlight math operators?
I am using the listings package to include GAUSS code to Latex.
E.g. like this:
\lstset{
emph={proc,retp,endp,local}, emphstyle=\color{blue}\textbf,
emph={[2]=,.^,./,=}, emphstyle={[2]\color{red}}
}
...
14
votes
6answers
3k views
Highlight text in code listing while also keeping syntax highlighting
I’m using the listings package for code listings. Now I try to highlight some part of the code using \hl from the soul package.
Here’s an example of a resulting query where the injected part of a SQL ...
4
votes
1answer
562 views
\fbox inside listings
I am trying to highlight a specific line inside a listing with listinline. The code I am currently using looks like this:
\begin{lstlisting}[escapechar=!]
class A {
void m() {
B b = ...
...
6
votes
2answers
1k views
Listing: Syntax highlighting for SPARQL query?
I use the following listing to show a SPARQL query:
\begin{lstlisting}[captionpos=b, caption=SPARQL query, label=lst:sparql]
PREFIX java: <http://evolizer.org/ontologies/seon/2009/06/java.owl#>
...
7
votes
1answer
2k views
XML highlighting - different style for attributes
I need to highlight syntax in my LaTeX presentation, so i've found this answer:
XML syntax highlighting
\lstdefinelanguage{XML}
{
morestring=[b]",
morestring=[s]{>}{<},
...
5
votes
3answers
1k views
Using keywords including a dot in the name with the listings package
I am using the listings package which works like charm in most cases.
I tried to define new languages for my needs with the help of morekeywords options in \lstset, but entering special keywords ...
17
votes
3answers
3k views
How can I highlight some lines from source code?
I am preparing a presentation (using beamer) and I'll need to include many snippets of source-code. For including source code, I'll probably use listings package. (I know there is also minted package, ...
4
votes
2answers
522 views
pass “global” options to minted/fancyvrb
Is there a way to override default options for the minted environment, rather than having to specify them for each and every snippet of code ?
In other words, is there an equivalent to listings's ...
18
votes
3answers
1k views
Typesetting LaTeX Source Code with the listings package
I am writing some documentation for a LaTeX package, in which I am going to be including some example LaTeX code. What is the best way to typeset that code? I know I could just use verbatim, but it ...
2
votes
1answer
920 views
operator highlighting using listings
How to color (using listings package?) C (or, well, any other programming language) operators? So that when I write
\begin{lstlistings}[language=C++]
int i = 0;
if(i > 1) {
// do ...
21
votes
2answers
3k views
How best to include programming source code in LaTeX documents? [duplicate]
Possible Duplicate:
Syntax Coloring in LaTeX
I'm relatively new to LaTeX, and am starting to use it for academic paper writing. I'm doing a lot of computer programming as part of my ...
43
votes
6answers
7k 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?