does US law travel with its citizens wherever they go, or does leaving US soil remove US legal obligations?
USA law travel with its citizens as long as USA law says it does, and can be enforced (trivially, if the offender returns to the USA then USA law can be enforced).
Even in some cases, USA laws can only be broken abroad (for example, a prohibition to travel to North Korea). If those laws were unenforceable because they were broken in foreign soil, they would be completely unenforceable.
Are there any legal precedents regarding the enforcement of a country's laws on its citizens abroad?
Yes, but all of the examples that I know of apply only to serious offenses against others, with laws that specifically include a provision for extraterritoriality, and often as a result of complaints that the foreign country is not doing enough to police the situation.
The most notorious example would be laws against "child-abuse tourism", in which people of wealthy countries visit developing countries (typically SE Asia) to engage in child sexual abuse.
This paper is quite old but it provides some examples of people convicted in their countries of origen for crimes abroad:
Amon Chemouil, French, was convicted in France in 2001 to 7 years of jail for sexually abusing a girl in Thailand.
Stefan Irving, from the USA, was convicted in the USA in 2006 to 21 years of jail for what seem to be several cases of sexual abuse to minors in Mexico.
Jan von Schelling, from the Netherlands, was convicted in the Netherlands in 1996 to five years of jail for sexual abuses against minors.
I will stop here, but it seems that there can be other examples.
And while the paper criticizes the system as being insufficient and that some times prosecutions are started only thanks to social pressure, it is also quite old (2008) and from what I read it seems that time law enforcement has become more profficient in prosecuting these crimes and related ones.
Suppose an American travels to Canada where (starting next week) marijuana is legal, and smokes to his lungs' content. Can he be charged under US law for possession and consumption of an illegal substance?
As mentioned above, the laws with extraterritoriality often specifically provide for it in its terms.
But even if the USA were to suddenly start prosecuting cannabis use abroad (Netherlands has had cannabis tourism for a long time with nobody complaining), there is the issue that they need to prove that you broke the law: proof that you went to Canada, that someone gave you some substance, that you smoke it and that such substance was cannabis. It can be very difficult to prove.
Even if there were evidence(say you were smoking somewhere where it is illegal, like in a maternity ward, and the Canadian police arrested you and made a report), then you need that:
So I would say that smoking cannabis while in Canada does not bring in a lot of legal danger.