  The performance of lithium and sodium ion batteries relies notably on the
accessibility to carbon electrodes of controllable porous structure and
chemical composition. This work reports a facile synthesis of well-defined
porous N-doped carbons (NPCs) using a poly(ionic liquid) (PIL) as precursor,
and graphene oxide (GO)-stabilized poly(methyl methacrylate) (PMMA)
nanoparticles as sacrificial template. The GO-stabilized PMMA nanoparticles
were first prepared and then decorated by a thin PIL coating before
carbonization. The resulting NPCs reached a satisfactory specific surface area
of up to 561 m2/g and a hierarchically meso- and macroporous structure while
keeping a nitrogen content of 2.6 wt %. Such NPCs delivered a high reversible
charge/discharge capacity of 1013 mA h/g over 200 cycles at 0.4 A/g for lithium
ion batteries (LIBs), and showed a good capacity of 204 mA h/g over 100 cycles
at 0.1 A/g for sodium ion batteries (SIBs).
