THEIR careers have been linked for more than 20 years. The many ties that bind Ian Rankin and John Rebus together are well known and cherished by their huge army of fans.
Now they are to be celebrated in a major exhibition exploring the creation of Rankin's famous fictional detective, the inspiration the author found in the city's dark underbelly, and how he and Rebus have changed with the times.
The National Library of Scotland has teamed up with the police and publisher Orion Books to organise Crime Scene Edinburgh: 20 Years of Rankin and Rebus, to coincide with the recent release of the final Rebus novel, Exit Music.
The library is playing host to a collection which lifts the lid on the author's previous jobs, including grape picker and chicken farmer, and gives an insight into his short-lived foray into the music industry, love of Raith Rovers, and passion for The Oxford Bar.
Visitors to the show, which runs from Wednesday until January 13, will also learn how early drafts of the first Rebus book, Knots and Crosses, were written in the library, when Rankin took time out from writing a PhD thesis on the work of Dame Muriel Spark.
Bruce Blacklaw, marketing officer for the library, said: "Ian Rankin has been a good friend to the library throughout his career and we're honoured and delighted to be staging this exhibition.
"The mix of Ian's own items, material from our collections and a wonderful assortment of things from Lothian and Borders Police have allowed us to chart Ian's career and influences, as well as those of Inspector Rebus.
"There's something here for everyone, from committed Rebus fans to those simply interested in learning a little more about Edinburgh's darker side."
Highlights include those first scribbled notes about the grizzled detective, the first manuscript of Knots and Crosses, the writer's old computer, and photographs dating back to Rankin's childhood.
Also included are the certificate for a short story competition Rankin won, copies of his favourite books, including Clockwork Orange and The Godfather, a first edition of The Prime of Miss Jean Brodie signed by Dame Muriel, and a cassette of Rankin's punk band the Dancing Pigs.
The manuscript for Sir Arthur Conan Doyle's first Sherlock Holmes book, the mysterious miniature coffins from the National Museum of Scotland which inspired a Rebus book, a recreation of the Oxford Bar, serial killer William Burke's death mask and police equipment such as handcuffs are also on show.
Not only will visitors get the chance to try their hand at solving a fictional murder said to have happened in the library, they will also get an insight into how fingerprinting, DNA and forensic tests are carried out.
City council leader Jenny Dawe said: "Ian Rankin is a great ambassador for the city with his Rebus books. This exhibition sounds absolutely enthralling."