Rail services have been disrupted around Edinburgh after high temperatures on the track affected signalling equipment.
Network Rail said temperatures on the tracks had reached 43C at Kincardine in Fife and they had also registered 38C to 40C on rails across the country.
A spokesman said most services were holding up well.
But he said a heat-related problem with points near Edinburgh Waverley had led to disruption to the west of the city.
Network Rail, which is responsible for rail infrastructure, also said there was a speed restriction of 30 mph on the Glasgow-Ayr line.
The spokesman said: "We've had our teams out since first thing, and we've tried to keep the system running.
"We've got a heat-related points issue at Edinburgh Waverley. That's led to disruption, with Waverley being such a busy station. It's having a residual effect lasting into rush hour, but it's clearing, and there are speed restrictions west of Haymarket.
"We're doing what we can to help passengers. They're getting bottles of water at Waverley."
Scotrail, which operates train services, said signalling problems at Edinburgh had led to trains being "cancelled, delayed or revised at short notice".
A spokesman said: "We would like to apologise to customers for any inconvenience caused by circumstances beyond our control."
Scotland has been experiencing the highest temperatures in the UK and it has again been the hottest day of 2013 north of the border.
Both the Strathallan weather station in Perthshire (28.7C) and Edinburgh Gogarbank (28.5C) topped 28C.
Threave in Kirkcudbrightshire recorded a temperature of 27.5C and Carterhouse in Roxburghshire was 27.2C.
Aboyne in Aberdeenshire reached 26.8C and the Glasgow Bishopton station in Renfrewshire recorded 26.5C.
However, Lerwick on Shetland was just 12C, which was cooler than Cairngorm summit at 14C.