Atmospheric abundances of exoplanets are thought to constrain the planet formation pathway, because different species evaporate at different temperatures and thus radii in the protoplanetary disc, leaving distinct signatures inside the accreted planetary atmosphere. In particular the planetary C/O ratio is thought to constrain the planet formation pathway, because of the condensation sequence of H 2 O, CO 2 , CH 4 , and CO, resulting in an increase of the gas phase C/O ratio with increasing distance to the host star. Here we use a disc evolution model including pebble growth, drift and evaporation coupled with a planet formation model that includes pebble and gas accretion as well as planet migration to compute the atmospheric compositions of giant planets. We compare our results to the recent observational constraints of the hot Jupiters WASP-77A b and τ Boötis b. WASP-77A b's atmosphere features sub-solar C/H, O/H, H 2 O/H with slightly super-solar C/O, while τ Boötis b's atmosphere features super-solar C/H, O/H and C/O with sub-solar H 2 O/H. Our simulations qualitatively reproduce these measurements and show that giants like WASP-77A b should start to form beyond the CO 2 evaporation front, while giants like τ Boötis b should originate from beyond the water ice line. Our model allows the formation of sub-and super-solar atmospheric compositions within the same framework. On the other hand, simulations without pebble evaporation, as used in classical models, can not reproduce the super-solar C/H and O/H ratios of τ Boötis b's atmosphere without the additional accretion of solids. Furthermore, we identify the α viscosity parameter of the disc as a key ingredient regarding planetary composition, because the viscosity drives the inward motion of volatile enriched vapor, responsible for the accretion of gaseous carbon and oxygen. Depending on the planet's migration history through the disc across different evaporation fronts, orderof-magnitude differences in atmospheric carbon and oxygen abundance should be expected. Our simulations additionally predict super-solar N/H for τ Boötis b and solar N/H for WASP-77A b. We conclude thus that pebble evaporation is a key ingredient to explain the variety of exoplanet atmospheres, because it can explain both, sub-and super-solar atmospheric abundances.