Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The documentation for the xcoffins package states:

In addition, coffins containing vertical-mode material also feature poles which reflect the richer nature of these systems:

B a pole running along the baseline of the material at the bottom of the coffin.

T a pole running along the baseline of the material at the top of the coffin.

In this example I can't see the difference between t and T:

\documentclass{article}
\usepackage{xcoffins}
\begin{document}
\NewCoffin \MyCoffin 
\SetVerticalCoffin \MyCoffin {60pt} {\noindent This\\ is a\\ small\\ g.}
\DisplayCoffinHandles \MyCoffin {red}
\end{document}

This is a small g.

share|improve this question
3  
'Known issue': I spotted this at the weekend in another context. Will be fixed in the next CTAN update, which will be some time in June. (There are various other things on the go, so now is not the moment for an update.) –  Joseph Wright May 23 '12 at 12:04
add comment

1 Answer

up vote 5 down vote accepted

The issue here arises due to an error on my part in l3coffins. There, you will find

\cs_new_protected:Npn \vcoffin_set:Nnn #1#2#3
  {
    \coffin_if_exist:NT #1
      {
        \vbox_set:Nn #1
          {
            \dim_set:Nn \tex_hsize:D {#2}
            \color_group_begin:
              \color_ensure_current:
              #3
            \color_group_end:
          }
        \coffin_reset_structure:N #1
        \coffin_update_poles:N #1
        \coffin_update_corners:N #1
        \vbox_set_top:Nn \l_coffin_internal_box { \vbox_unpack:N #1 }
        \coffin_set_pole:Nnx #1 { T }
          {
            { 0 pt }
            { \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_coffin_internal_box } }
            { 1000 pt }
            { 0 pt }
          }
        \box_clear:N \l_coffin_internal_box
      }
  }

The problem is with the \color_ensure_current: line, which is incorrect. In the SVN, this line is removed. This fix will appear in the next CTAN snapshot, which is expected some time in June. In the meantime, you can fix it locally by using

\usepackage{expl3}
\ExplSyntaxOn
\cs_set_protected:Npn \vcoffin_set:Nnn #1#2#3
  {
    \coffin_if_exist:NT #1
      {
        \vbox_set:Nn #1
          {
            \dim_set:Nn \tex_hsize:D {#2}
            \color_group_begin:
              #3
            \color_group_end:
          }
        \coffin_reset_structure:N #1
        \coffin_update_poles:N #1
        \coffin_update_corners:N #1
        \vbox_set_top:Nn \l_coffin_internal_box { \vbox_unpack:N #1 }
        \coffin_set_pole:Nnx #1 { T }
          {
            { 0 pt }
            { \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_coffin_internal_box } }
            { 1000 pt }
            { 0 pt }
          }
        \box_clear:N \l_coffin_internal_box
      }
  }
\ExplSyntaxOff

in your preamble.


For those who would like to know why this is happening, the way that the T pole is set is ultimately using the \vtop primitive. That will only give the correct box height if the very first item in a vertical box is itself a box. The \color_ensure_current: function creates a whatsit, which therefore breaks the calculation. So for the moment this line has been removed (mirroring LaTeX2e box behaviour, where only hboxes ensure that the current colour is used for the foreground).

share|improve this answer
    
this is why we are looking for people to help us with providing further test cases for all the expl3 code. We are trying to make unit and integration tests for all parts of the code, but there is always room for improvement and need for help –  Frank Mittelbach May 23 '12 at 14:55
    
@FrankMittelbach Well, if I'd spotted this when I set the tests up then we would have found this :-) –  Joseph Wright May 23 '12 at 14:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.