Why do I get different alignment when using \selectlanguage in the second coffin rather than \foreignlanguage (TL 2017)?
The issue is the specials that \selectlanguage
inserts. It is meant to switch the 'entire' language so adds to the toc
, etc.:
...........\write1{\select@language{welsh}}
...........\write1{\@writefile{toc}{\select@language{welsh}}}
...........\write1{\@writefile{lof}{\select@language{welsh}}}
...........\write1{\@writefile{lot}{\select@language{welsh}}}
(from \showoutput
). On the other hand, \foreignlanguage
doesn't do this: it's for 'local' changes only. That makes a difference as the \write
node at the start of the box means that we can't 'see' the baseline of the first row of text: the \write
node is the reference point and it comes at the top of the text.
This is a 'known issue' in TeX, most obviously with colour specials. The LaTeX3 xgalley
approach can solve it by carefully managing all such operations, but it currently doesn't 'play nicely' with the vast majority of LaTeX2e packages. So for the present you will need to use avoid such switches right at the top of boxes.