A libretto is the text which is paired with a dramatic musical work, and it is typically written in verse. Libretti accompany operas, musicals, masques, chorales, and a wide assortment of other forms of musical performance; they are quite simply the words which pair with the music to bring a story to life. Many firms publish libretti for use by performers and theaters when productions are mounted, and it is also possible to purchase a libretto which has been designed for use by fans of the music, containing commentary on the text and the music.
The concept of the libretto is quite ancient, as humans have been performing dramatic music work for hundreds of years. However, the libretto really rose as an art form in the 17th century, when number of prominent librettists began writing very fine prose works to accompany opera. Many people associate the concept of the libretto specifically with opera and the operatic tradition.
Typically, the librettist is not the composer of the work, although there are a few notable exceptions to this, such as Wagner. The libretto may be written before the music, or in cooperation with the composer as he or she works on a piece, and it often requires frequent and finicky adjustment to fit with the music. Ideally, the text of the libretto meshes perfectly with the music, creating a harmonious and beautiful performance of song and music which captivates viewers of the performance.
There are several ways to publish a libretto. Commonly, a libretto is published in an entirely separate book, without music, allowing people to analyze the content of the libretto to learn more about the work. The libretto is also included in the vast and cumbersome master orchestrations for performances, which include all of the musical parts, from the drums to the singers, along with stage directions and notations on how the music should be performed.
Libretti are produced in a wide variety of languages, as you might imagine, and when they are published as separate books, many companies produce the original libretto along with a translation. Like other verse compositions, libretti do not always translate well, as the art of the libretto lies in a complex scansion which is dependent on the sounds of the language it is written in.