text: New figures show the total number of teachers across Scotland has risen, but 12 council areas saw numbers fall.
  Mr Swinney said the stats were "good news" in light of recruitment "challenges" in some areas.
  Opposition parties said numbers were still down over the long term.
  And they said parents "have a right to be very angry" about the attainment gap between pupils from better and worse-off backgrounds.
  The latest figures showed teacher numbers were up for the first time in several years, with 51,000 employed in state schools in 2016.
  But in 12 local authorities the numbers fell, with the largest percentage drop in Moray, which has highlighted recruitment problems in the past.
  The figures were among a fresh batch of important statistics being published on the state of the Scottish education system.
  The ratio of pupils to teachers was maintained across Scotland but the average size of a class crept up slightly to 23.5 students.
  Nationally, the number of teachers fell between 2010 and 2014 then stabilised.
  The number of teachers fell in 12 council areas, including in Highland and Dumfries and Galloway, although in both these regions the ratio of pupils to teachers was maintained at the same level.
  In 12 council areas the ratio of pupils to teachers got worse in 2016, including in Edinburgh and Fife where teacher numbers had risen. These were:
  The government expects the ratio of pupils to teachers to be maintained, although BBC Scotland understands the councils will not face any financial sanctions.
  Many councils have told BBC Scotland that they are finding it hard to fill some vacancies.
  Recently the Scottish government unveiled a number of initiatives to try to encourage more people into teaching, and some local authorities have also launched their own initiatives.
  The latest statistics also showed:
  Separate figures, published on Tuesday, looked at the number of children considered by teachers to be performing at the required level for their age in Curriculum for Excellence.
  The data showed that between 65% and 85% of pupils in primary schools achieved the relevant level in aspects of literacy and numeracy. However, the proportion of pupils achieving the relevant level for their stage decreased throughout the primary stages.
  Updating MSPs on the figures, Mr Swinney said: "I very much welcome the rise in teacher numbers compared to last year, the fact that class sizes are broadly stable and that the pupil-teacher ratio has been maintained.
  "This is all good news, particularly when you consider the teacher recruitment challenges being faced in some areas.
  "The data shows that significant improvements are required in some local authorities, and real challenges exist in delivering the progress in literacy and numeracy we seek.
  "There is much to be proud of in Scottish education; we need to remain focused on and committed to Curriculum for Excellence and we need to continue to implement the reforms we are putting in place."
  Scotland's largest teaching union, the EIS, welcomed the rise in teacher numbers but said some "significant challenges" continued to face schools.
  General secretary Larry Flanagan said: "The number of teachers employed across Scotland has held steady, and actually shows a small increase overall, indicating the local authorities have adhered to a commitment brokered between the EIS and local and national government to maintain teacher numbers over the year.
  "This is very welcome, and is helping to improve employment prospects for qualified teachers and ensure that young people have consistent levels of provision in schools across Scotland.
  "The EIS would certainly expect the Scottish government to continue its commitment to maintaining teacher numbers, and we hope to hear confirmation soon from the finance minister in his forthcoming financial statement."
  He added: "Given the welcome Scottish government commitment to tackling the attainment gap, the trend of rising class sizes is an issue that must be tackled through greater investment in a greater number of qualified teachers."
  The Scottish Conservatives said teacher numbers were still thousands below the levels they were at in 2007.
  The party's education spokeswoman Liz Smith said: "With teacher numbers having plummeted from the levels they were at a decade ago, it once again calls into question whether the CfE can be delivered properly.
  "There are a number of legitimate concerns about the curriculum, and these statistics are further evidence that we need to have proper independent scrutiny of how it is being implemented."
  Ms Smith also told Mr Swinney that parents "have a right to be very angry" about the gulf in achievement between pupils from differing financial circumstances.
  The Scottish Greens' education spokesman Ross Greer questioned the government's decision to publish statistics on how well schools pupils were doing in certain areas of the Curriculum for Excellence.
  He said: "Today's figures demonstrate the utterly bizarre education priorities the Scottish government has. We see class sizes continue to creep up, making them the highest they've been since the SNP formed the government and nine years after they promised to reduce them to 18.
  "More teachers and smaller classes are vital if we're to improve the quality of education."
  Meanwhile, Scottish Labour leader Kezia Dugdale accused the SNP of "slashing" spending on Scotland's school pupils by more than 8%.
  She highlighted analysis by the Scottish Parliament Information Centre (SPICe) which she said showed that real-terms spend on education fell from Â£6,692-per-pupil in 2010/11 to Â£6,152 in 2014-15.
  She said: "Nicola Sturgeon promised to make education her top priority, but Scotland has plunged down the international league tables on her watch.
  "Year-on-year cuts to school budgets, teacher numbers and support staff are damaging the life chances of Scotland's children."
  Scottish Liberal Democrat education spokesperson Tavish Scott MSP said: "Today's figures show that after a decade in power, the SNP has failed to deliver on its commitment of smaller class sizes for our youngest pupils."
  The latest figures a week after it emerged that Scotland's schools had recorded their worst-ever performance in an international survey of pupils.
  The country's scores for maths, reading and science all declined in the latest set of Programme for International Student Assessment (Pisa) figures.
  It was the first time since the tests began in 2000 that Scotland's performance in all three subject areas was classed as "average", with none "above average", among the 72 countries that took part.
  The Curriculum for Excellence has been introduced in Scottish schools in recent years, with the country's qualifications system also overhauled.
  However, teaching unions have complained about "excessive and unsustainable" workloads as a result of some of the changes.
target: Education Secretary John Swinney has welcomed an overall increase in teacher numbers in Scotland - although he said "significant improvements" were needed in some areas.