How do you display straight quotes instead of curly quotes when using LaTeX's 'listings' package?

I'm using LaTeX's "listings" package to format source code. Unfortunately I get curly quotes instead of straight quotes. Since the curly quotes don't always point in the right direction, it looks...

LaTeX source code listing like in professional books

How should a latex source code listing look like to produce an output like in known books, for example one for the Spring Framework? I've tried with the latex listings package but wasn't able to...

Highlighting a Chunk of Code within a lstlisting

I have a bunch of code in a lstlisting environment. How can I highlight (color background) just a particular chunk of code within the environment?

Change "List of Listings" text

I tried to change the "List of Listings" text with the command \renewcommand*{\lstlistlistingname}{List of XYZ} before my \begin{document}. What's wrong with this? By the...

Latex: Listings with monospace fonts

This is what the code looks in Xcode. And this in my listing created with texlive. And yes I used basicstyle=\ttfamily . Having looked at the manual of listings I haven't found anything about...

LaTex, issue with Beamer and Listings

I'm trying to add some code in a presentation made with LaTex. I used beamer, added some frames without problems but once I add the listing, I can't compile the presentation...

LaTeX: remove left margin of listing inside a table

Using LaTeX, I need to show some code snippet inside a table. Here is an example of what I'm trying to do: \begin{document} Par exemple : \begin{center} \begin{tabular}{lp{5cm}l} \hline Méthode...

Code listing in LaTeX beamer presentation frames

I'm trying to create a LaTeX beamer presentation that has several Java code listings. However, I encountered a very bizarre problem - my listing snippet causes a compilation failure when in the...

Currency symbols inside lstlisting

I am trying to add a GBP \pounds symbol inside lstlisting \begin{lstlisting} Lorem ipsum 3£ \pounds \end{lstlisting} However this results in the following line: Lorem ipsum 3Â \pounds How do...

Vim syntax highlighting with $ and lstlisting's lstinline

If I use the inline version of lstlisting as shown: \lstinline{!$omp parallel for} the syntax highlighting in vim goes wrong, and the remainder of the latex file is coloured red as if it is all...

How to export a reference to a #begin_src block to LaTeX

I'm exporting an ORG file to LaTeX with org-latex-listings set to t. The file contains some source listings, and I want to insert some references to them. In the generated TEX file, the reference...

Latex : New listings : lstnewenvironment

I want to define a new listings. \begin{script}{caption:Algorithm caption}{label:alg-label} aaa \end{script} I define like this : \newcounter{script} \lstnewenvironment{script}[2]{ ...

Including \lstlistoflistings and reference it in the table of contents

I have a question about including a directory for listings in my table of content. I'm using \lstlistoflistings and \tableofcontents and the \usepackage{listings}. Now my question: When I...

Bullet list inside lstlisting

I am very new to Latex. I use lstlisting package to create grey boxes with code/text. I'm able to set bold, italic or underline, but I'm not able to add a bullet list inside my box. I tried the...

Latex listings: title above the listing should be different than the title in the list of listings

You can create a listing in Latex like this \begin{lstlisting}[caption={foo}] test \end{lstlisting} Above the listing is written "foo", in the list of listings is also written "foo". I want...

lstlisting code is blue instead of black - keywordstyle taking over?

When using lstlisting and certain parameters, (most) code turns blue, even though it should only be keywords and identifiers, while the rest should have a black color. For good measure, the rest...

Switch language within code listing using lstlisting

I'm using lstlisting to insert Java code in my text. But within the same listing I want to change font color for a few lines while continuing with the same listing format. My objective is to only...

LaTeX Listing Not Visible

I am using the listings package, but only the caption is showing, not the inner text. The code is definitely not showing anywhere in the document, including after downloading the PDF (I'm using...

LyX can't compile Program Listing

I am using LyX to make a summery of my lectures. When I try to Insert -> Program Listing, it fails to compile the file into PDF, raising the next errors (sorry that I didn't post the image itself...

LaTeX newcommand with verbatim or listings : problem with `#` (hash key)

I'm trying to define a macro with \newcommand using verbatim or listings environment. It seems that the hash key in #1 (standing for the argument) is escaped, due to verbatim and listings. I'm new...

How can I generate footnote URL links with an R function in bookdown / knitr documents?

I try to generate URL links through an R-function. These links are inteded to be included in footnotes primarily. I generate the links in text references, and this works nicely in html output. In...

How to include both Agda and Isabelle code in the same latex file?

I am creating presentation slides using beamer, and on the slides I want to include pieces of code from Agda and Isabelle standard libraries. All I can find online is generating latex from Agda...

org-mode export to PDF source code block ill-formatted

I'm having this problem: My org file with a source code block, when exporting to PDF the source is not properly exported. Here is the content of the file: #+TITLE: A Document with Emacs-Lisp...

How to add text to each entry in the "list of listings"?

I need to use the package "listings" in a huge XeLaTeX document to modify each entry in the "list of listings". I managed to show the chapter number, the number within chapter, the caption,...

Markdown and references inside the listing captions

Is it possible to process the text markdown for the listing captions in pandoc? Pandoc works well for figure captions and translates the emphasis and inline code, but apparently fails to do so in...

How to use lstlisting package with regular expressions / special chars?

I want to show a php function with a regex in a code snippet using the lstlisting package. TeX gives me several errors "Package inputenc Error: Invalid UTF-8 byte sequence" and the dollar sign...

Is tcolorbox compatible with tabular, tabularx?

Some combination betwen tcolorbox, listing and tabularx tabular do not compile. Is it possible to solve problem between tabular tabularx and tcolorbox and tabularx and listing? Is tcolorbox...

Vector address starts in the middle of program memory

I'm using MPLabX IDE 5.4 with XC8 compiler (a C/MPASM hybrid compiler that has a driver named pic-as v.2.2 as its assembler) to compile/assemble a simple piece of assembly code and to output a...

Can't put Python listing in LaTeX

I'm trying to put a Python listing into a \fbox\parbox but I always get errors. Here is my code: \documentclass[12pt]{article} % Packages \usepackage[utf8]{inputenc} % support for...

Insert inline code block in Latex document

Hi i am trying to add an inline code block in a Latex document. I know how to add a separate code block using lstlisting but i want to instead add an inline code block. I am attaching the...