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 Freedom series, by the last book the aliens are hopelessly addicted to Coffee and it serves as a major trade and diplomacy item.
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.
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.
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.
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.
The fact that Ford worked PLERGB into a Star Trek novel — and one put out by a mainstream publishing house! — is awesomeness in and of itself.
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.
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. In at least one book, he is shown to settle for a Poor Man's Substitute for coffee made from burnt bread and a lot of 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"
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 homebrew beer, with water appearing only on rare occasions. He's had coffee fairly frequently as well.
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 coffee. (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 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.
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.
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.
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...
In Captain Vorpatril's Alliance, "[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."
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."
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.
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.