James was talking to Karl, the former being much smarter than the latter.
Is James the former or the latter? What is the rule?
Basically: "former" = "first item in a pair", "latter" = "second item in a pair".
So, in your case, "the former" is James, while "the latter" is Karl.
The mnemonic I learned in school was (F)ormer is (F)irst and (L)atter is (L)ast, so James is the former and Karl is the latter.
"Former" comes before, and "latter" comes later.