Generation and detection of pulsed terahertz waves in gas: from elongated plasmas to microplasmas