National Geographic Style Manual has moved to
Abbreviate as an armed forces rank with full name.
May be spelled out for the commanding officer of a ship:
Captain Edward J. Smith of the Titanic
the captain
See also MILITARY RANKS, TITLES OF PERSONS.