Template synthesis of mesoporous carbons with a controlled particle size