Template gallery
================

Abjad provides a growing number of score templates in the ``templates``
directory. ::

   abjad$ ls templates/

   __init__.py  lagos.ly     paris.ly     test
   coventry.ly  oedo.ly      tangiers.ly  tirnaveni.ly

Each template in the ``templates`` directory is a native LilyPond ``.ly``
file with layout, paper and grob settings appropriate for different
types of score.


Default LilyPond layout
-----------------------

<abjad>
import random
pitches = [random.randrange(0, 25) for x in range(32)]
staff_1 = Staff([ ])
staff_2 = Staff([ ])
score = Score([staff_1, staff_2])
staff_1.extend([Note(x, (1, 8)) for x in pitches[:16]])
staff_2.extend([Note(x, (1, 8)) for x in pitches[16:]])
write_ly(score, 'default') <hide
show(score)
</abjad>


``coventry.ly``
---------------

.. note:: File is rotated because template is landscape.

<abjad>
import random <hide
pitches = [random.randrange(0, 25) for x in range(32)]
staff_1 = Staff([ ])
staff_2 = Staff([ ])
score = Score([staff_1, staff_2])
staff_1.extend([Note(x, (1, 8)) for x in pitches[:16]])
staff_2.extend([Note(x, (1, 8)) for x in pitches[16:]])
write_ly(score, '_coventry', template = 'coventry') <hide
show(score, template = 'coventry')
</abjad>


``lagos.ly``
------------

<abjad>
import random <hide
pitches = [random.randrange(0, 25) for x in range(32)]
staff_1 = Staff([ ])
staff_2 = Staff([ ])
score = Score([staff_1, staff_2])
staff_1.extend([Note(x, (1, 8)) for x in pitches[:16]])
staff_2.extend([Note(x, (1, 8)) for x in pitches[16:]])
write_ly(score, '_lagos', template = 'lagos') <hide
show(score, template = 'lagos')
</abjad>


``oedo.ly``
-----------

<abjad>
import random <hide
pitches = [random.randrange(0, 25) for x in range(32)]
staff_1 = Staff([ ])
staff_2 = Staff([ ])
score = Score([staff_1, staff_2])
staff_1.extend([Note(x, (1, 8)) for x in pitches[:16]])
staff_2.extend([Note(x, (1, 8)) for x in pitches[16:]])
write_ly(score, '_oedo', template = 'oedo') <hide
show(score, template = 'oedo')
</abjad>


``paris.ly``
------------

.. note:: File is rotated because template is landscape.

<abjad>
import random <hide
pitches = [random.randrange(0, 25) for x in range(32)]
staff_1 = Staff([ ])
staff_2 = Staff([ ])
score = Score([staff_1, staff_2])
staff_1.extend([Note(x, (1, 8)) for x in pitches[:16]])
staff_2.extend([Note(x, (1, 8)) for x in pitches[16:]])
write_ly(score, '_paris', template = 'paris') <hide
show(score, template = 'paris')
</abjad>


``tangiers.ly``
---------------

<abjad>
import random <hide
pitches = [random.randrange(0, 25) for x in range(32)]
staff_1 = Staff([ ])
staff_2 = Staff([ ])
score = Score([staff_1, staff_2])
staff_1.extend([Note(x, (1, 8)) for x in pitches[:16]])
staff_2.extend([Note(x, (1, 8)) for x in pitches[16:]])
write_ly(score, '_tangiers', template = 'tangiers') <hide
show(score, template = 'tangiers')
</abjad>


``tirnaveni.ly``
----------------

<abjad>
import random <hide
pitches = [random.randrange(0, 25) for x in range(32)]
staff_1 = Staff([ ])
staff_2 = Staff([ ])
score = Score([staff_1, staff_2])
staff_1.extend([Note(x, (1, 8)) for x in pitches[:16]])
staff_2.extend([Note(x, (1, 8)) for x in pitches[16:]])
write_ly(score, '_tirnaveni', template = 'tirnaveni') <hide
show(score, template = 'tirnaveni')
</abjad>


.. todo:: Teach ``abjad-book`` to recognize and rotate landscape images.

.. todo:: More whitespace between sections.

.. todo:: More complex comparison score with notes, rests, chords,
   tuplets and line breaks.
