The last hours in the life o f Robert Louis Stevenson, as told in a letter written by his grieving widow, has been bought by the National Library of Scotland.

"The rest of my life will be empty and lonely," Fanny Stevenson writes in the heartbroken missive she wrote after the great writer died on December 3, 1894, in Samoa.

The letter, from Fanny to a friend, was written the day after her husband, creator of books including Treasure Island and Strange Case of Dr Jekyll and Mr Hyde, collapsed from what is believed to have been a brain haemorrhage.

That day, she writes, the Scottish writer had told her he did not want to die in bed.

"That very day he had said to me ‘the thought of dying in bed is horrible to me; I want to die like a clean human being on my feet," she said.

The National Library of Scotland (NLS) purchased the letter at auction as part of a number of Robert Louis Stevenson materials for £26,000 from Christie’s of London on 13 July this year.

The purchase was wholly funded by the Soutar Trust and the Friends of the NLS.

The letter was part of the Anne Jenkin papers sold that day.

Anne Jenkin was the widow of Fleeming Jenkin (1833-1885), an engineer and academic, and Stevenson’s professor and friend.

In tight script on small notepaper, Fanny Stevenson writes: "His life had been one long romance and he hoped to have a romantic end; the artist in him demanded that completeness.

"To grow old he could not bear. He has had his wish and, for that, I try to be thankful, though all the rest of my life will be empty and lonely. True, I have my children but I have not Louis. No one knows what that means but me."

She says she had been crushed by a sense of impending disaster for days before Stevenson’s death and he had sought to lighten her mood by playing cards.

Then, together, they began to make mayonnaise for dinner.

She writes: "I began to mix the mayonnaise; he dropping the oil with a steady hand, drop by drop. Suddenly, he set down the bottle, knelt by the table, leaning his head against it. I cannot go on just now."

However, she adds: "It was the hand of death that had stricken him down.

"In less than five minutes he was profoundly insensible and so remained till the end. It was about six when he knelt at the table and at ten minutes after eight, he passed away. In a very short time, we had two doctors and a medical missionary here but there was nothing to do."

The letter is one of a series sent by Fanny to Mrs Jenkin and her husband.

The letters, together with an incomplete manuscript of an essay, telegrams, photographs and newspaper cuttings, were bought by the NLS.

Details of the latest acquisition, which was bought with the support of the Soutar Trust and the Friends of the National Libraries, are being released as the anniversary of Stevenson’s death approaches.

Dr John Scally, the National Librarian, said: "It is pleasing that these letters relating to one of Scotland’s greatest ever writers are part of the collection in the city and the country of his birth.

"They are sure to be of interest to scholars and the wider public and we are delighted to have acquired them."

Fanny’s letter also describes the affection of native Samoans to her husband, who was known to them as Tusitala or story teller.

Stevenson’s wish was to be buried at the top of Mount Vaea which overlooked his home on Samoa.

Fulfilling that wish led to forty Samoans labouring to cut a path through the bush to the ancient burial place of chiefs.

There, his grave was dug and a makeshift tinsel cross was placed at its head.

“Nothing that money could buy would have pleased Louis more or more clearly touched his heart than that little tinsel cross,” she adds.

Stevenson had been dogged by ill health for most of his life and lived in many places to try to find a climate best suited to his health.

"I try to remember how he had hoped to go like this," Fanny writes.

"That very day he had said to me ‘the thought of dying in bed is horrible to me; I want to die like a clean human being on my feet. I want to die in my clothes, to fall just as I stand.’ He did. It was only at the very end, for the last few breaths, that we laid him down."