Don't crash when the page title is RTL; context dir should == paragraph dir.

The \setRTL command was being output before the LaTeX header.  Adding
`dirBreak` and `envBreak` at the appropriate places ensures that
directionality commands are appropriately grouped.  Also tweak the
rules for setting the default context direction to ensure that the
context direction matches the desired paragraph direction.

Change-Id: I3a7eaee6ce216f4bd7254ced55061a64591082c0