Kapton-type polyimide films with and without boron incorporated (symbols PI-SB and PI) were carbonized and graphitized up to 2600 degreesC with the aim of creating nanospaces into carbon by doping boron and/or nitrogen and characterizing them. Carbonization of PI and commercially available polymer films containing nitrogen revealed that nitrogen atoms, which are the substitute for carbon atoms in the hexagonal structure, remained at 1200 degreesC, independent of the structure of polymers. The dissolved nitrogen in PI disappeared above 2400 degreesC. The nitrogen atoms trap most of the extra electrons introduced by themselves and do not cause much imbalance of net charge around them. The nitrogen atom, however, slightly displaces (ca. 0.02 nm) from the plane and breaks planar structure due to C-N bond nature. These two factors create electronically and geometrically unique nanospaces in carbon hexagonal structure. On carbonizing PI-SB, dropB-N drop bonds started to form in the films around 800 degreesC, and these bonds were broken above 1200 degreesC and boron atoms started to substitute carbon atoms in the turbostratic structure The dropB-N drop bonds disappeared above 2200 degreesC but the dissolved boron did not even at 2600 degreesC. The dissolved boron atoms and dropB-N drop bonds create imbalance of net charge around them, leading to the increment of hole concentration. They do not break planar structure of carbon hexagonal layer but are presumed to create edges or boundaries of crystals, leading to the increment of structural defects. Accordingly, nanospaces created by boron are different from those by nitrogen. (C) 2001 Elsevier Science B.V. All rights reserved.