Book and Quill

A book and quill is an item used to write written books.

Writing
By pressing or long pressing screen anywhere while holding a book and quill in their hand, the player can open a text editor GUI.

Using this GUI, the player can write a single book up to 100 pages or 50 long, with up to 255 characters per page, with line breaks counting as two characters. The player can write up to 12,800 characters inside the entire book. No page may be longer than 14 lines and each line can have a width of 113 pixels (see pixel width of each character here).

The player has the ability to copy and paste into books. However, the paste does not work if the text being pasted is longer than a single page. Most Unicode characters are available in books, and they may be pasted in without issue.

In singleplayer, the world pauses while a book is being edited.

Lecterns
One can place a book and quill or a written book on an empty lectern.

The lectern then emits a redstone signal depending on the displayed page in the book. On the last page, the lectern emits a signal strength of 15. This is why lecterns are listed in the "redstone" tab in the creative inventory.

Formatting codes
Text in a book can be styled using codes starting with the character (section sign).
 * + creates randomly changing characters.
 * + creates bold text.
 * + creates italic text.
 * + –  (hexadecimal) creates colored text.
 * + resets any of the previous styles so text after it appears normally.

If the player uses multiple codes, and continue typing past the end of a line, the next line exhibits only the last formatting code used.

Signing
Books can be signed by pressing the "Sign" button while in the interface. $$, when signed, a book bears the name of the player who wrote it and a title chosen upon signing. $$, the book doesn't get the name of the player, instead, it gets any text the player wants. After it has been signed, it cannot be edited again – it has turned into a written book.

The title of the book can be up to 16 characters long, and the player cannot paste into a title. Special characters can be used in the title, if typed from a keyboard that supports them. Alt codes do not work, and the character cannot be typed even using a keyboard that implements it, meaning titles cannot be colored or formatted in-game. However, on Linux using the compose key to produce special characters does work.

Trading
Expert-level librarian villagers buy a book and quill for one emerald.

Expert-level librarian villagers have a 50% chance to buy 2 book and quills for one emerald.

Data values
Book and quill items have a data value of 386, and the ID name. They use their item data to determine the contents of the book.

Item data

 * : The item
 * : The tag tag.
 * : The list of pages in the book.
 * A single page in the book. If generated in-game, each page is a string in double quotes and uses the escape sequences \" for a double quote, \n for a line break and \\ for a backslash. If created by commands or external tools, a page can be a serialized JSON object or an array of strings and/or objects (see Commands) or an unescaped string.

Trivia

 * The in-game restrictions on books are not hard limits. Third party editors or commands can make books have more than 100 pages (2,147,483,639 pages), more than 256 characters per page (32,767 characters per page), can change author names, and can have colored titles, among other things. These books still function properly in vanilla Minecraft, meaning the player may encounter such books on adventure maps or multiplayer servers.
 * Although the name blank is only 16 characters long, the player can give it a longer name using an anvil.
 * If the player renames a book and quill in an anvil before signing it, it retains the name from the anvil instead of taking the name from signing.
 * If the player renames a book and quill in an anvil before writing in it, they cannot write anything in the book. If something is written in it before it is renamed, then it functions normally.