Skip to content

Scheme syntax highlighting for the LaTeX listings package.

Notifications You must be signed in to change notification settings

adam-7/scheme-listings

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scheme listings in LaTeX

Example

LaTeX code:

\documentclass{article}
\usepackage{listings}
\usepackage{color}
\usepackage{textcomp}

\lstset{
  language=Scheme
}

\begin{document}

\title{A Scheme Listing in \LaTeX}
\date{}
\maketitle

\begin{lstlisting}
;; The Y combinator
(define Y
  (lambda (f)
    ((lambda (x) (f (lambda arg (apply (x x) arg))))
     (lambda (x) (f (lambda arg (apply (x x) arg)))))))

;; Factorial function using the Y combinator
(define fact
  (Y (lambda (f)
       (lambda (n)
         (if (<= n 0)
             1
             (* n (f (- n 1))))))))     
\end{lstlisting}

\end{document}

As an alternative to lstlisting, Scheme code can also be included from an external file:

\lstinputlisting{ycombinator.ss}

Rendered:

Rendered example

Installation

The scheme-listings directory must be on your TeX search path.

To use LaTeX from the Bash shell, add this to your shell config file (e.g. .bashrc):

export TEXINPUTS=/path/to/scheme-listings/:$TEXINPUTS

For Emacs, use:

(setenv "TEXINPUTS" (concat "/path/to/scheme-listings/:" (getenv "TEXINPUTS")))

About

Scheme syntax highlighting for the LaTeX listings package.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TeX 100.0%