The modern pencil, as we know it, was invented in 1795 by Nicholas-Jacques Conté, a French scientist and army officer, who developed a method of mixing powdered graphite with clay, firing the mixture, and encasing it in wood. 

Here's a more detailed look at the pencil's history:

Early Use of Graphite:

Graphite, a soft crystalline form of carbon, has been used since the Neolithic period for decorating pottery and as a black pigment. 

Discovery of Pure Graphite:

In 1564, a large deposit of pure graphite was discovered in Borrowdale, England, which led to the development of graphite sticks for writing and drawing. 

The Need for a Better Pencil:

During the Napoleonic Wars, France faced a shortage of high-quality graphite, which was primarily imported from England. 

Conté's Innovation:

To address this problem, Nicholas-Jacques Conté, an officer in Napoleon's army, developed a method of mixing powdered graphite with clay, forming the mixture into rods, and baking them in a kiln. 

The HB Scale:

By varying the ratio of graphite to clay, Conté was able to control the hardness of the pencil lead, leading to the development of the HB scale, which grades pencils according to their hardness (H) and blackness (B). 

Modern Pencil Production:

Conté's method of mixing graphite with clay and encasing it in wood remains the standard for pencil production today. 

Conté's Legacy:

Conté's invention revolutionized writing and drawing tools, making them more precise, durable, and affordable, and his company, Conté à Paris, is still a leading maker of drawing materials.