\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{listings}

\begin{document}

This is a line of text. \textbf{Abjad} code follows:

<abjad>
v = Voice(construct.run(8))
print v
f(v)
</abjad>

Another line of text. More \textbf{Abjad} code follows. Notice that in the second block of \textbf{Abjad} code we can reference objects and variables crated in previous blocks:

<abjad>
Beam(v)
show(v)
write_ly(v, 'example1', 'oedo') <hide
</abjad>

Here is paragraph 3, and more \textbf{Abjad} code.

<abjad>
pitchtools.diatonicize(v)
for leaf in v: print leaf
Trill(v[2:])
show(v)
write_ly(v, 'example2', 'oedo') <hide
</abjad>

And a final paragraph. Here all the code is hidden:

<abjad>
PianoPedal(v[:]) <hide
write_ly(v, "example4", 'oedo') <hide
</abjad>

\end{document}
