Situated in Edinburgh
the National Library of Scotland http://www.nls.uk/ is Scotland's only copyright deposit library,which means that a copy of every book published in Britain must be lodged there.Many historically important books and manuscripts from the 11th century are found here and growing at 400,000 a year. It holds 7 million books and over 2 million maps. It regularly holds exhibitions,the most recent exhibited the final letter of Mary Queen of Scots before her execution.
There are many informative pages on Scottish family history covering all topics from vital records to newspapers and emigration. I will post more later about their extensive online collection of Scottish maps which are held in another repository.