How the king's visit saw kilts become Scotland's national dress
King George IV was ruthlessly caricatured during a visit to Scotland 200 years ago for wearing his kilt too short but it was to be the pivotal moment for Scotland's national dress.
The pomp and pageantry of the royal visit, orchestrated by internationally famous author Sir Walter Scott, would go down in history as the trip that reinvented tartan and placed it at the centre of the country's image.
The Edinburgh visit in August 1822 was the first visit of a monarch north of the border in 172 years and Scott carefully arranged the extravaganza right down to what people were to wear.
Historian Eric Melvin told BBC Scotland that Scott proclaimed no gentleman was allowed to appear at the King's Highland ball in anything but the ancient Highland costume and it took 300 unemployed tailors to kit them out.
For some Scottish Lowlanders who saw the Gaelic-speaking Highlands as a barbarous backwater, the kilt had been regarded as the primitive dress of mountain thieves.
But despite the portly king's fashion faux pas - pairing a short kilt with a pair of sheer pink silk tights - Scott's insistence on tartan pageantry during the trip elevated the kilt to become part of Scotland's national identity.
Scott was the author of wildly popular novels such as Waverley, which gave a romantic image of the Scottish Highlands.
In 1815 this led him to being invited for dinner with George, who was then Prince Regent.
Mr Melvin said: "At a dinner in London, Walter Scott had persuaded George that he was as much a Stuart as Bonnie Prince Charlie had been.
"He should come to his royal capital of the ancient kingdom of his ancestors.
"George was flattered by the suggestion and agreed in principle that the proposed visit should go ahead once he had succeeded his father, the ailing George III."
The old king died in 1820 and in July 1822 Edinburgh's lord provost received a letter announcing that George IV would visit the capital the following month.
Mr Melvin said: "There was widespread panic at the short notice as this was to be the first visit by a reigning monarch since the short visit of the fugitive Charles II in 1650."
Scott was put in charge of the trip's arrangements.
"This was to be a celebration of Scotland and in particular the Highlands of Scotland," Mr Melvin said.
"Walter Scott rushed out an anonymous guide to his fellow Scots on the etiquette to be observed during the forthcoming royal visit." Copies of the advice sold out.
Scott also wrote a personal letter to every Highland chief summoning them to Edinburgh.
It said: "The King is coming after all! Arms and men are the best things that we have to show him."
Fitted out with tartan
Mr Melvin said there was a very positive response, given the little time there was for the clan chiefs to make arrangements.
He said: "Lt Col Sir Ewan Murray MacGregor, Chief of the Clan Gregor, brought 50 men to Edinburgh.
"They were fitted out with tartan from a supplier in the North Bridge with their weapons provided by John McLeod of Castle Street. The weapons alone cost £148.
"The officers were provided with grander costumes supplied by Romanes and Paterson at the Scottish Tartan Warehouse in North Bridge."
King George IV set off by boat on 10 August 1822 from Greenwich in England but was unable to land at Leith in the Firth of Forth until 15 August due to bad weather.
Mr Melvin said: "An army of workmen was engaged to clean the streets and to knock down ruinous buildings. These included the old Butter Tron at the foot of the Castlehill.
"Water and gas were piped into Holyrood Palace, though it was agreed that the king and his entourage were to stay at the splendid Dalkeith Palace, home to the 16-year-old 5th Duke of Buccleuch."
The approach road to Dalkeith Palace was rerouted and a special laundry and dairy were hurriedly constructed, Mr Melvin said.
"Billets had to be found for the hundreds of soldiers who were to be drafted into the town," the historian added. "Four Bow Street Runners were sent to Edinburgh to deal with the flood of London pickpockets expected to come north with the king."
The king's enormous royal household was brought by sea, Mr Melvin said. There were 100 cases of plate and the king's throne offloaded at Leith and taken by cart to Dalkeith Palace.
Huge bonfire
"In anticipation, six cannon were hauled to the top of the Bass Rock in the Firth of Forth and a 45ft flagpole was erected to salute the arrival of the royal visitor," Mr Melvin said.
"A huge bonfire was built on the top of Arthur's Seat. In addition, Edinburgh braced itself for the influx of thousands of visitors anxious to be part of the celebrations."
The Glasgow Herald reported: "Glasgow, as far as we can see, will be almost deserted on the occasion - every vehicle of conveyance is fully employed and engaged for the coming days.
"Extra boats on the canal are insufficient for the number of passengers. Where the moving mass from all corners of the land are to stow themselves when in Edinburgh, we know not.
"Many, we understand, are provided with or are providing themselves with tents and intend to bivouac in the fields."
Sir Thomas Mash, controller of accounts in the Lord Chamberlain's office, arrived in Edinburgh to take control but Scott would not give way.
Mr Melvin said: "Scott told Mash 'When his majesty comes amongst us, he comes to his ancient kingdom of Scotland and must be received according to ancient usages.
"If you persist in bringing in English customs we turn about, one and all, and leave you. You take the responsibility on yourself."
Mash backed down. It was to be Scott's show.
On 15 August, 1822, the escort of Highlanders mustered in Queen Street Gardens. They were joined by Sir Walter Scott dressed in trews as a sore rash prevented him from wearing a kilt.
National anthem
They set off for Leith and were joined by the military to welcome the king.
The Royal George docked and at midday the king was brought ashore to a "tumultuous" welcome.
When he saw the crowds on Calton Hill singing the national anthem, he was overcome with emotion and wept.
There were fireworks, processions and visits over the coming days.
It was on Saturday 17 August the king wore full Highland costume with flesh-coloured silk tights and a short kilt.
It prompted one observer, Lady Hamilton-Dalrymple, to remark: "Since his stay was so short, the more we see of him the better."