How hidden orders generate gaps in one-dimensional fermionic systems