5
votes
2answers
81 views

Remove margin from listings in beamer

I am including some code in my beamer document. I would like to get rid of all margins, so I can include as much code as possible. This is the code I am trying: \documentclass[]{beamer} ...
4
votes
1answer
72 views

lstlistings does not work in a slide

I am writing a slide. I want to use lstlisting \documentclass[10pt]{beamer} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage[T1]{fontenc} \usepackage{lmodern} ...
3
votes
1answer
77 views

listings using tcolorbox for beamer documentclass

I'm trying to get listings using tcolorbox for beamer documentclass. My MWE is given below but could not get it working. Any help will be highly appreciated. Thanks MWE \documentclass{article} ...
2
votes
0answers
40 views

Problem with beamer and listings package, cannot obtain pdf [closed]

I want to use \usepackage{listings} in a beamer presentation. I obtain "Process exited normally" but it says "Error no file found". The process exits normally but texmaker doesn't find any pdf file. ...
1
vote
0answers
32 views

Problems using listings package and beamer [duplicate]

I'm having problems using listings package in a beamer documentclass. "! Paragraph ended before \lst@next was complete." my code: \documentclass[compress]{beamer} ... \usepackage{listings} ... ...
4
votes
1answer
67 views

Restatable example containing code listing

I am creating a beamer presentation, and I'm using the packages thmtools, thm-restate and listings. Inside one of my \frames, I want to create an example block containing a code listing. Later, I want ...
6
votes
1answer
104 views

Problem with listings when using line numbers, `name`, and `beamer` overlays

It's is well known that to ensure that a certain <counter> is automatically reset on subsequent slides of a same frame one has to use either \resetcounteronoverlays{<counter>} (for LaTeX ...
4
votes
1answer
206 views

tikzmark, listings and beamer's onlyenv

I found this limitation in the current tikzmark solution for highlighting lines of listings code in beamer. When I put the whole lot in an onlyenv environment, it seems the marks are not set, or ...
2
votes
1answer
995 views

Lstlisting in beamer presentation

I would like to insert a source code listing into my beamer presentation. I learnt that we cannot use lstlisting directly in the frame environment, so I am using the following trick: ...
1
vote
0answers
26 views

Using mcode within a beamer frame [duplicate]

I have a presentation that I would like to include some matlab code in. For that purpose I have included the mcode package, that basically configures the listings package. My problem is that the ...
0
votes
0answers
22 views

\lstinline does not work with \frame in beamer [duplicate]

\documentclass{beamer} \usepackage{listings} \lstset{ basicstyle=\ttfamily\footnotesize, breaklines=true } \begin{document} \begin{frame} Normal text \lstinline{\usepackage} \end{frame} \end{document} ...
0
votes
1answer
354 views

including python code in beamer? [closed]

Suppose I have a python file. How can I include in beamer presentation in one of the slides? \insertcode{"Scripts/mc.py"}{Python} does not work with \usepackage{listings} , which otherwise work in ...
3
votes
1answer
155 views

Coloring or Bolding multiple lines in fancyvrb integration with listings

I would like to apply latex commands on a bunch of lines in a Verbatim environment with listings, especially make bold or color a block of code. I am able to do that for a single line, but not for ...
6
votes
1answer
792 views

LaTeX commands in Verbatim using fancyvrb and listings

I am trying to use LaTeX commands like \textbf, \textit, \textcolor in fancyvrb combined with listings. Especially I want to bold and color any text or entire blocks of Java code (not just keywords) ...
4
votes
2answers
184 views

Integrating listings with fancyvrb

I am trying to use fancyvrb with listings and I get an error saying l.2 ...{Verbatim}[formatcom={\lstset{style=Java}}] Package Listings Error: language java undefined. ...
4
votes
2answers
210 views

tcolorbox listing error using beamers begin{frame}

I've just started using the tcolorbox package for slides for a LaTeX course. It works nicely to box LaTeX code, interacting with the listings package. However, I ran into trouble when I tried to make ...
1
vote
0answers
59 views

Dropping boxes on top of the listings environment [closed]

I was wondering if anyone knew a decent way to drop boxes of text on top of the listings environment. This would be most useful for a beamer presentation that I am currently writing. Ideally the text ...
5
votes
1answer
195 views

\lstMakeShortInline with @ delimiter

I'm including a fair amount of inline C++ code in a beamer presentation I'm making, and I want to be able to use the short syntax for \lstinline. My code displays fine if I use, for example, the ! ...
5
votes
2answers
745 views

Beamer Latex Code Error In Listings Environment

I want to display a short latex code in my beamer. The code is also the about beamer. And I don't want to use the \lstinputlisting{file.tex}. So is there any way to do that? Here is the code without ...
6
votes
1answer
2k views

Can't insert code in my beamer slide

I want to put some PHP code in my slide with the package listings but I have this error message: Argument of \frame has an extra }.<inserted text>\par } My latex code : ...
6
votes
1answer
776 views

Using beamer's \uncover with the listings package

I want use listings package with uncover command. He's my code \usepackage{listings} \lstnewenvironment{Exemplecode}{}{} \newenvironment{Framecode}[1] {\begin{frame}[fragile, ...
8
votes
2answers
730 views

Highlighting haskell listings in large *.tex document [duplicate]

Suppose, there is a large *.tex document, which has many nested \input directives with many Haskell listings surrounded by \begin{code} \end{code} commands. How can all this code listings be ...
5
votes
1answer
111 views

Is it possible to use the listings package incrementally in beamer?

Given a frame that has code rendered in a \begin{lstlisting}...\end{lstlisting} environment, is it possible to use beamer's incremental frame building feature to highlight code snippets? Here is an ...
6
votes
1answer
530 views

Strange error when combining Beamer, Animate, Tikz and Listings

I'm working on some slides where I show how code is actually executed in Java. Therefore I'm working with the animate package to generate animations. Without going into details, I've written a macro ...
9
votes
2answers
513 views

Two code blocks working syncronously

I need two code blocks in my beamer frame. One will be the code and other will be the output for each line of code. I want to uncover each code line and corresponding output line. So, first it will ...
3
votes
1answer
401 views

Problem highlighting listings in beamer

I'm using listings inside beamer to typeset some Octave code. Because I want to apply overlay specifications to parts of the listing as I go through the slides (for highlighting purposes), I'm ...
0
votes
1answer
157 views

Changing code in listings dynamically [closed]

I need to change dynamically the code in the listing by adding just one key word to the code. I tried to do it like this: \begin{lstlisting}[escapechar=|] class MyThread extends Thread { private ...
1
vote
1answer
440 views

Create two column with vertical line in a presentation

I'm doing a beamer presentation in LaTeX, and I want know if it's possible make something like this:
5
votes
2answers
513 views

Is there a non-verbatim form of lstinline from the listings package?

I'm using the listings package with beamer and I'd like to try to avoid making frames fragile where possible. I know that many of my frames will need to be fragile but there are some where the ...
4
votes
1answer
953 views

A line in the lstlisting environment cannot start with “\end{frame}” in a beamer presentation

I'm making a presentation about LaTeX using the beamer package (v3.10). I'm using the listings (v1.4) package to print pieces of latex source code and highlight the keywords. It seems that the ...
4
votes
1answer
143 views

Possible to adjust character width?

I'm using Beamer and lstlisting to put some code in a presentation. The character spacing feels a bit too wide to my eye. Is it possible to reduce it? I've tried searching on this SE but can't seem ...
9
votes
1answer
11k views

How do I add syntax coloring to my C++ source code in beamer

I have just learned how to insert source code into beamer with the listings package. However I dont know how to go about adding any syntax coloring on the C++ source code. How do I do that? Here ...
3
votes
1answer
320 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
897 views

Problem with alignment in listings

I have a follow up question to this post I am using listings in beamer. The content in listings is being pushed further left than the other contents on my slides. I am using the code below to correct ...
3
votes
1answer
787 views

Problem with lstlisting in beamer… What am I doing wrong?

I am trying to to put an lstlisting environment in the left column, but I'm getting errors. Are lstlisting and the columns environment in beamer incompatible? Or is it something else? ...
6
votes
1answer
1k views

Inserting TeX code into beamer - Problem with otherkeywords

I am preparing a beamer presentation and using the lstlisting environment in order to put in TeX code. I am using the following code which is largely copied from here: ...
9
votes
1answer
1k views

Beamer - Using \pause within lstlisting

I am preparing a beamer presentation and using the lstlisting environment in order to put in code. However, I would like to use the \pause command within lstlisting. By definition that is not ...
2
votes
1answer
224 views

listings ignore final newline

When I write listings in my LaTeX code I usually follow this format \begin{lstlisting} foo bar baz \end{lstlisting} and when I put this inside a normal LaTeX document, things look fine. But when I ...
4
votes
1answer
454 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 ...
5
votes
1answer
1k views

Remove top and bottom margins around listings

When using the lstlisting environment, or similar ones from the listings package, there are paragraph-like margins above and below the actual text. This makes sense in a paper, but gets in the way if ...
1
vote
2answers
1k views

LaTeX listing counter counts with every \pause-command?

I'm writing a TeX-File for a beamer presentation and have a problem with the \pause-command and the listing counter: The Listing counter increments its count with every \pause command – although I ...
3
votes
2answers
5k views

Frame around minipage containing listing in beamer

I am working on the sheets of a course on LaTeX and would like to have several sheets in which you see on the left an example of a source document and on the right its output. I have this working now ...
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, ...
9
votes
1answer
792 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 ...
1
vote
1answer
883 views

LaTeX - Multiple pages on a code listing inside a beamer frame

I'm trying to put some Python code on a beamer slide. I would like to take one big file and print it with lstinputlisting. I've tried to set the frame fragile with: \begin{frame} [fragile] ...
6
votes
3answers
1k views

Smaller frame with listings

I am using listings to put java code in my beamer slides. Sometimes, I want to frame the code but I do not want the frame to occupy the whole width of the page. I want the frame to occupy only the ...
9
votes
1answer
7k 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
1answer
7k views

Automatically resize lstlisting fontsize in a beamer slide

I have frames of the following format (code followed by an itemize): \begin{frame}[fragile] \frametitle{Blah} \begin{lstlisting} Five to seven lines of code here... \end{lstlisting} ...
8
votes
1answer
2k views

How to define a new environment with a fancy box (tikz) around sample source-code (listings)?

This is what I want to do: \documentclass{beamer} \begin{document} \begin{frame}[fragile]{Frame 1} Some \structure{Python} code here: % I want to define a new "pythoncode" environment, so ...
14
votes
3answers
5k views

How to make overlay still work inside lstlisting environment?

Problem I want to explain C# programming language step by step using overlay in beamer.cls. But it does NOT works as shown in the following figure. How to solve this problem? Code Snippet ...