Synthesis of crystalline metal nitride and metal carbide nanostructures by sol-gel chemistry