Entanglement negativity in extended systems: a field theoretical approach