The textbooks on classical harmony that I have read (Leo Semlek, "Klassikalise harmoonia lühiõpik" ["A Short Textbook on Classical Harmony"] and "Klassikalise harmoonia õpik" ["A Textbook on Classical Harmony"]) say that if V7 is in root position the fifth can be omitted (and the root is doubled).
There are some cases where he says that one should only use V7 without the fifth:
- After II7
- After IV
How does one decide when to omit the fifth? What is special about II7 and IV? In the case of II7, wouldn't it be a good idea to use the root of II7 as the fifth of V7?
I'm curious about the possible reasons because I am trying to write a computer program for generating nice classical chord progressions. It would be cleaner to have some kind of general rule ("omit the fifth if...") instead of adding several just-because special cases.
And are there any reasons why the textbook tells that the fifth can be omitted in V7 in root position but explicitly tells to not omit the fifth in the inversions of V7 or in any other seventh chord (II7 and VII7)? What is special about V7 in root position?