Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using LaTeX Beamer to display code

I'm using the following LaTeX code in a Beamer presentation:

\begin{frame}
  \begin{figure}
  \centering
      \tiny
   \lstset{language=python}
         \lstinputlisting{code/get_extent.py}
   \end{figure}
\end{frame}

Is it possible to select specific lines from my get_extent.py file rather than displaying it all?

like image 385
djq Avatar asked Jan 25 '10 20:01

djq


People also ask

How do you use beamer in LaTeX?

To start our presentation we need to set the document class to beamer . Next we'll select a theme using the \usetheme command; for our example we'll use the Boadilla theme. Just like any other LaTeX document we need to enclose our document in the document environment.

How do I make a table of contents in beamer?

Creating the table of contents in Beamer can be done with the same manner as in standard LaTeX. The first thing that we should do is to structure our presentation using the commands \section{} and \subsection{} ( \section*{} and \subsection*{} , to hide it from table of contents).

Is beamer a Documentclass in LaTeX?

Beamer is a LaTeX document class for creating presentation slides, with a wide range of templates and a set of features for making slideshow effects. It supports pdfLaTeX, LaTeX + dvips, LuaLaTeX and XeLaTeX.


1 Answers

This has nothing to do with beamer; it's about a listings feature. Its excellent manual has more. For example:

\lstinputlisting[firstline=2,lastline=5]{code/get_extent.py}
like image 104
Thomas Avatar answered Oct 28 '22 18:10

Thomas