  Atmospheric abundances are thought to constrain the planet formation pathway,
because different species evaporate at different temperatures leaving distinct
signatures in the accreted atmosphere. 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. 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
observations of the hot Jupiters WASP-77A b and $\tau$ Bo\"otis b, which
feature sub-solar and super-solar C/H and O/H values, respectively. Our
simulations reproduce these measurements and show that giants like WASP-77A b
should start to form beyond the CO$_2$ evaporation front, while giants like
$\tau$ Bo\"otis b should originate from beyond the H$_2$O line. Our model
allows the formation of sub- and super-solar atmospheric compositions. However
simulations without pebble evaporation can not reproduce the super-solar C/H
and O/H ratios of $\tau$ Bo\"otis b's atmosphere without additional accretion
of solids. We identify the $\alpha$ viscosity parameter of the disc as a key
ingredient, because the viscosity drives the inward motion of volatile enriched
vapor, responsible for the accretion of gaseous C and O. Depending on the
planet's migration history order-of-magnitude differences in atmospheric C/H
and O/H are expected. Our simulations also predict super-solar N/H for $\tau$
Bo\"otis b and solar N/H for WASP-77A b. We conclude 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.
