King Charles III was given the keys to the City of Edinburgh in a ceremony at the Palace of Holyroodhouse.
The king, alongside Queen Camilla, took part in the Ceremony of the Keys in the garden of the palace, his official residence in Scotland, after inspecting the guard of honour.
Queen Camilla later hosted writers, publishers and booksellers to the palace in a celebration of Scottish literacy.
Crime authors Sir Ian Rankin and Val McDermid and newly-knighted Sir Alexander McCall Smith, creator of The No 1 Ladies’ Detective Agency series, were among Camilla’s guests.
She gathered the group associated with literature as she began her official stay in Scotland with the King, known as Holyrood Week, shorter this year because of General Election restrictions. Author Alexander McCall Smith was knighted for services to literature, academia and charity at an investiture ceremony at the palace.
Others to be honoured on Tuesday, after being named in the King’s New Year Honours, include Paul Mealor, professor of composition at the University of Aberdeen and Professor Sir Jim McDonald, principal of the University of Strathclyde, who was appointed Knight Grand Cross of the Order of the British Empire for services to engineering, education and energy.
Liz Smith, a former Scotland cricketer who is now a Conservative MSP, became a CBE for services to sport, while members of the emergency services were also among the more than 50 people honoured on Tuesday.