Under Abbasid caliphal patronage, Al-Hajjaj ibn Yusuf ibn Matar made in Baghdad the first Arabic translation of Euclid's Elements, also working on Ptolemy's Almagest. His version of the Elements, now lost in its original form, was the basis for later Arab translators and revisers before the work reached medieval Latin Europe via Gerard of Cremona.