4
votes
1answer
41 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
64 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
117 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
101 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
23 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
20 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
135 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
101 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
409 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
114 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
141 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
52 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
115 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
503 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
556 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 : ...
5
votes
1answer
580 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, ...
7
votes
2answers
478 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
102 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
456 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
459 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 ...
1
vote
0answers
325 views

highlight listings in beamer

While trying to use listings and beamer, for highlight some parts of the code I found the following: How to make overlay still work inside lstlisting environment? However I notice that I can't ...
0
votes
1answer
146 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
324 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
427 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 ...
3
votes
1answer
769 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
134 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 ...
7
votes
1answer
7k 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
286 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
730 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 ...
6
votes
1answer
926 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: ...
8
votes
1answer
943 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
209 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
424 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
910 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 ...
2
votes
2answers
4k 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
698 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
774 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] ...
5
votes
3answers
905 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
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
1answer
6k 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} ...
7
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 ...
0
votes
1answer
2k views

How to prevent beamer from removing the tab alignment of lstlisting?

I want to show my C# code snippet on the presentation slides using beamer. Because the code is long, I set the frame to be breakable using the frame option allowframebreaks. The code now can be shown ...
6
votes
3answers
3k views

LaTeX beamer: Code listings in notes

How can I add a code listing to a beamer note slide? I tried the following which doesn't work: \note{{\tiny{This is a note \begin{lstlisting} foo bar \end{lstlisting}}} Any ...
9
votes
1answer
1k views

how to colorize syntax using R + Sweave?

I'm writing a LaTeX document using Sweave (a Beamer presentation, really), which weaves R code and LaTeX. Is there a way to make my chunks of code and its output highlighted? I could use listings ...
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?
9
votes
3answers
872 views

Apply style to specific lines of a listings environment

I want to emphasize some lines in a listing environment by applying a special style on them (for example, a different background color). All custom styling seem to be content-based. I would like to ...