We obtain a new equation of state for the nucleonic and hyperonic inner core of neutron stars that fulfills the 2 M _ { \odot } observations as well as the recent determinations of stellar radii below 13 km . The nucleonic equation of state is obtained from a new parametrization of the FSU2 relativistic mean-field functional that satisfies these latest astrophysical constraints and , at the same time , reproduces the properties of nuclear matter and finite nuclei while fulfilling the restrictions on high-density matter deduced from heavy-ion collisions . On the one hand , the equation of state of neutron star matter is softened around saturation density , which increases the compactness of canonical neutron stars leading to stellar radii below 13 km . On the other hand , the equation of state is stiff enough at higher densities to fulfill the 2 M _ { \odot } limit . By a slight modification of the parametrization , we also find that the constraints of 2 M _ { \odot } neutron stars with radii around 13 km are satisfied when hyperons are considered . The inclusion of the high magnetic fields present in magnetars further stiffens the equation of state . Hyperonic magnetars with magnetic fields in the surface of \sim 10 ^ { 15 } G and with values of \sim 10 ^ { 18 } G in the interior can reach maximum masses of 2 M _ { \odot } with radii in the 12-13 km range .