pedantic

(adj) narrowly, stodgily, and often ostentatiously learned  
The haughty professor was pedantic but his students knew which buttons to push to get an A.