Optimization of etching processes for micro- and nanostructuring