Two kinds of polymethacrylates, 1 and 2, with 2-styrylpyridine and 4styrylpyridine moiety as a photoreactive group, which have a benzoate group as a mesogenic unit, and hexylene group as a flexible spacer in the same side chain, were synthesized to characterize their alignment behaviors. The UV absorption and fluorescence studies on the two polymers revealed that the latter polymer with the 4-stylrylpyridine moiety is more aggregative than the former polymer with the 2-styrylpyridine moiety. The polymer 1 showed a nematic phase structure at 170 8C, while 2 appeared in a partially bilayered smectic A phase structure in the homeotropic direction at 175 8C. The polymer 1 film generated an in-plane alignment by a linearly polarized UV light irradiation and subsequent annealing, and its direction was parallel with respect to the irradiation. On the other hand, the polymer 2 film with the same treatments gave a high out-of-plane order parameter of 0.73 in a wide temperature range of 120-240 8C. The significant differences in the aggregation behavior, the liquid-crystalline structure, and the alignment between the two polymers were discussed by the structural differences between the 2-and 4-styrylpyridine moieties in the two polymers. V V C 2008 Wiley Periodicals, Inc. J Polym Sci Part A: Polym Chem 46: 5371-5380, 2008