2

I prepared a program written in GAP's envirounment. I'd like to put them all in one of my beamer pages exactly as follows:

gap> z:=CyclicGroup(IsPermGroup,10);; n:=CyclicGroup(IsPermGroup,15);;
     s:=DirectProduct( z, n );;
     e:=Elements(s);;
     r:=Filtered(e,t->Order(t)=10);;
     Size(r);;

What can I do? I used \text{} to get the result as it is shown above but it's useless. Thanks for any help.

Mikasa
  • 589

1 Answers1

4

You may wish to look into the listings package which was designed for exactly that task.

A minimal example would look like so:

\documentclass{beamer}
\usepackage{listings}
\begin{document}
\begin{frame}[fragile]{Example with listings}
    Code can be included and formatted with the \lstinline{listings} package:
    \begin{lstlisting}
gap> z:=CyclicGroup(IsPermGroup,10);; n:=CyclicGroup(IsPermGroup,15);;
     s:=DirectProduct( z, n );;
     e:=Elements(s);;
     r:=Filtered(e,t->Order(t)=10);;
     Size(r);;
    \end{lstlisting}
\end{frame}
\end{document}

and produce this output: basic output

listings comes with a host of formatting options, including line breaking, font size and selection as well as syntax based highlighting of code - see the package documentation as well as these answers here on TeX.SX: [1], [2].

greyshade
  • 3,576