In a sort of recursive example, her short story "Nad and Dan and Quaffy" is about a science-fiction author with a coffee addiction who tends to write all her main characters as having an addiction to whatever the in-universe equivalent is.
And in her novel Deep Secret, the character Nick is completely incoherent and can't even open his eyes in the morning until he's had four cups. (This is apparently based on Neil Gaiman's real-life morning routine as witnessed at a convention.) In the sequel, The Merlin Conspiracy, Nick admits that he completely exaggerates his difficulties waking up, so that people won't bother him until he's feeling less grumpy.
In a somewhat milder example, in Dark Lord of Derkholm, Finn, one of the minor characters, mentions how he asked to be paid in coffee beans for serving as a wizard for one of the Pilgrim Parties that tears through his world on a regular basis, since the stuff normally only comes from Earth. Derk, who specializes in breeding all sorts of unique plants and animals, has managed to cultivate his own crop, which delights Finn to no end.
In Anne McCaffrey's Catteni series, by the last book the aliens are hopelessly addicted to Coffee and it serves as a major trade and diplomacy item.
And in The Ship Who... Sang, Helva stocks three times the normal amount of coffee.
In Monstrous Regiment, Maladict is a vampire who has replaced cravings for blood with cravings for coffee. When the coffee runs out, the vampire starts to go a little nuts, acting like a character from a Vietnam War movie ("Charlie's tracking us!" "Who's Charlie?"). Otto Chriek gives Polly dire warnings of what will happen if Maladict doesn't get coffee, and mentions that vampires have been known to hallucinate so vividly that other people experience them. Later in the book, the regiment hears helicopters overhead, which (unless Leonard of Quirm's air-screw from The Last Hero counts) don't exist on the Discworld. Eventually, the regiment roasts some acorns as a temporary substitute: this is Truth in Television, as noted in the Real Life section.
Dave Barry often mentions his need for coffee in his articles and his novels often have his heroes addicted to the drink as well.
Elizabeth Vaughan's books use this trope in a mostly-rural fantasy setting. Kavage makes everything a little more bearable, and most characters wouldn't think of going a day without it.
One of the first things the time-displaced Americans do in the 1632 series is arrange to import coffee. Then they start exporting coffee-houses. In the first book, it's also noted that bothering the high school vice principal, Len Trout, before his third cup of coffee in the morning is a very bad idea, comparable to taunting Cthulu in inadvisability.
Dr. Harvey, the guy who discovered the circulation of blood, wins friends for life when he presents the Granvillers with a couple of pounds of coffee and tells them where and how to get more.
Harvey: "I've never seen grown men cry like that, and over a beverage!"
When a joke book lists "Fun Things to Do at Work", it's likely to mention something along the lines of "Replace the coffee in the coffee machines with decaf. When everyone has gotten over their addictions, switch to espresso". The smart version of this is not to switch suddenly to decaf, but blend it in gradually over a few months. Of course, this is now rather more difficult to do than before as many places replace their traditional coffee makers with single-serving pod-based ones.
Whether coffee is fresh and hot, cold and stale, or a horrible mix of both, Colt Regan will still drink it, because it's still coffee.
In the novel How Much for Just the Planet?, by John M. Ford, it's quickly established over breakfast that "Bones McCoy was Not a Morning Person". Despite the coffee he fails to notice his grits are bright orange — though everybody else at the table does. He also didn't notice Kirk's electric blue "orange juice" until he'd finished the mug. (The food replicators were malfunctioning that morning.)
Bones: Plergb hrafizz umgemby, and coffee.
Another novel had "coffee" that was dispensed in freeze-dried cubes, which apparently had all the taste qualities of transmission fluid. The owner of the freighter Captain Kirk is hitching a ride on says she keeps her own stash of beans so she won't have to drink that swill.
In the Star Trek: Deep Space Nine Relaunch, there's Ms. DellaMonica, a refugee Ezri Dax has to deal with. The author of that book was the same author who introduced Bacco, actually...
The recently released novel "The Crimson Shadow" has significant parts of the Cardassian population addicted to Coffee due to Federation assistance in the aftermath of the Dominion War.
Lampshaded in the Nora Roberts book Tribute, in which the hero (a graphic novelist) leaves some coffee along with "before" and "after" pictures of her—before the caffeine bearing a strong resemblance to a drowned rat, and after the caffeine as the new Wonder Woman.
Honor Harrington averts the trope, enjoying cocoa instead. Naturally, everyone who drinks coffee is jokingly called a "barbarian coffee drinker." Note that this includes almost every single character in the series except Honor herself. Honor's preference of cocoa instead of coffee comes off as an inversion of the series' general premise of Horatio HornblowerIN SPACE!. A shot of Fridge Brilliance sets in when one considers that this might be a Chekhov's Gun - Honor is eventually revealed to have a very high-speed metabolism, compliments of some genetic tweaks her ancestors received. As a result, she has to constantly consume high-caloric foodstuffs. Including mountains of chocolate chip cookies.
Horatio Hornblower is an avid coffee drinker, in contrast to the normal assumption that a British officer would be drinking tea. Unfortunately he usually can't afford enough to sustain him through a voyage and has to make do with a Poor Man's Substitute most of the time: burnt bread in hot water with sugar.
The title characters are often seen sharing an entire pot of coffee. At several points, it's noted that neither is fully human without their morning coffee, and there's a minor crisis in Post Captain when upon moving to a new command Jack Aubrey discovers, much to his horror, that there is no coffee.
Or in The Mauritius Command, when, upon being informed that rats have eaten all of their coffee beans, Jack says to his steward "Killick, you may tell Mr Seymore, with my compliments, that you are to have a boat. And if you don't find at least a stone of beans among the squadron, you need not come back." This to a man who, at this point has served him loyally for over a decade.
It is also mentioned in passing that Captain Aubrey takes his coffee with a splash of cream, and keeps a goat on ship specifically to supply said cream.
Almost all of the protagonists in Peacebreakers are hopelessly addicted to coffee, which, according to Word of God, is a small jibe at the role of coffee in workplace melodrama.
The Dresden Files: Harry Dresden's liquid diet consists almost entirely of Coca-Cola and homebrewed beer, with water appearing only on rare occasions. He's had coffee fairly frequently as well.
In the short story Day Off, his student bribes him with fresh Starbucks.
According to Dragonsdawn, the first two things a group of humans will actively try and find on a new planet are: something that they can ferment into alcohol, and something they can turn into a coffee substitute. (Much to the dismay of the colonists, coffee bushes won't grow on Pern - or any other planet humans have colonized). The brave ones drink klah (a beverage made from a type of native tree bark) instead, but one colonist plots to steal a ship and leave, partly because they've run out of coffee.
In The Mote in God's Eye, Horace Bury is a coffee connoisseur who at one point shows off his stash to the crew of a Russian-themed warship, who favored tea. The royal family has their own reserved farm for growing coffee beans that no-one else is allowed to touch; Bury paid a ridiculous price to get his hands on some, wouldn't do it again but it was so good he doesn't regret it. The crew of MacArthur are less than enthusiastic about exterminating the vermin infesting their ship because, among other things, they vastly improved the operation of the ship's coffeemaker and the taste of its output.
In fact when their ship has to be abandoned the captain gives specific instructions for one of the officers to bring along the new and improved coffee machine despite having to abandon almost everything else. The sequel reveals that they reverse engineered it and the navy is in the process of replacing all of their coffee machines with the new type.
Most, if not all, of the characters in The Millennium Trilogy seem to subsist on a lot of coffee. Apparently, writer Stieg Larsson was like this in real life as well.
This led to some Values Dissonance with the books' American readers. Many American literary critics mockingly claimed that no-one should be able to consume those amounts of coffee and survive. Swedes, on the other hand, consider between six and eight cups a day to be a large consumption of coffee, but not remarkably so.
Barbara Vine (Ruth Rendell)'s ripping good yarn Asta's Book (first published in the U.S. as Anna's Book) is about a Danish woman living in 1905 London. In her diary, she says Danish people need coffee more than food and talks about drinking three cups in the morning even when they're short on money and have to be careful. As an old lady living with her daughter, one of her catch phrases is "Do I smell the good coffee?"
Garrison Keillor has some immortal words about Norwegians and coffee in Leaving Home. "He poured himself a cup of coffee, drank some, kissed his wife — in that order, he is Norwegian." Later he says coffee has been known to revive Norwegians who have flatlined.
In the In Death series Eve lives on coffee and Pepsi. In fact, the first present Roarke ever gives her is a bag of coffee.
Dragaera: Vlad will drink normal coffee if he must, but he prefers "klava," a fictional beverage made from coffee and several other ingredients filtered through an eggshell. It seems to be the only thing about Dragaeran society that Vlad likes. Just about every book includes scenes of Vlad fussing over his need for klava.
In Ranger's Apprentice, the Rangers' main drink, and one you would not want to deprive them of, is coffee.
In Myth-Taken Identity, the Barista at the Mall is a Cafiend from Caf, the dimension where coffee was invented. Her species literallyMust Have Caffeine to live, and a sign reading "THE COFFEE IS THE LIFE" is displayed above her coffee shop.
"[Admiral] Desplains took a revivifying sip of fresh-brewed. Ivan wished he could remember which famous officer had once said, The Imperial Service could win a war without coffee, but would prefer not to have to."note A paraphrase of American Naval officer and military historian's statement that "The Navy could probably win a war without coffee but it wouldn't like to try."
Ivan's citizenship bride complains that Immigration, the cops and a friend out to warn them all arrived first thing in the morning 'Before anybody had drunk any coffee.'
Inverted in Tom Clancy's Jack Ryan series, where Dr. Carolyn Ryan, Jack's wife, specifically does not drink coffee the evening before she is scheduled to perform delicate laser eye surgery. She doesn't want her hand to jitter even a little.
Mary Russell's The Sparrow has an earth exploration team bringing lots of coffee along on their First Contact mission. It goes from a Running Gag to a trade item and ultimately a plot point.
In Freaky Friday, Annabel's mother needs her coffee, and gets grouchy when told she can't have it because it will stunt her growth.
Ciaphas Cain (HERO OF THE IMPERIUM!) served with a Valhallan regiment; as a result, he always tries to keep a supply of tanna leaf (an expy of a very strong Russian tea) nearby. He even jokes that he fought his way across half a planet and an ork Waaagh! (warboss included) for it.
At one point, an overworked Cain is sleeping in his office when Broklaw, the regiment's second in command, comes in and snarks at him about it... but he brings hot coffee, so Cain spares him. His editor is quick to point out that Cain's joking... she thinks.
Empress Celene in The Masked Empire drinks so much tea every day that she has a caffeine addiction, suffering headaches when she doesn't have enough (headaches being one symptom of caffeine withdrawal). She even has a teapot that is magically heated near her most of the time.
Beth Johannsen, one of the Ares 3 crew in The Martian, requires coffee upon waking for any functioning, not just optimal.
Anita Blake can't live without her coffee. She even looks down on other coffee drinkers who don't prepare it the "right" way (i.e., her way).
The Paratime Police force seems to run on coffee, and nicotine.
The German story Rock Crystal by Adalbert Stifter has two children, Conrad and his sister Sanna, trapped in a hillside during a snowstorm doing their best to stay alive. Conrad remembers that his father told him that those who slept during a snowstorm are likely to freeze to death, and does his best to keep his sister awake, finally resorting to black coffee given to him by his grandmother in a flask, and giving a sip to his sister to keep her from falling asleep. The coffee literally keeps them alive and they take turns drinking it to stay awake during the snowstorm.