I'm trying to create a XeTeX class which aligns text vertically on a grid. What I'm trying to achieve is layout on the left (created in InDesign), and what I'm generating now is on the right (the document text's baseline is not aligned with the grid):


I'm using geometry package with page head just below the top margin (includehead option). I use fancyhdr package to render these headings.

Question: how to specify \headheight and \headsep, so that the page content is aligned with the grid.

I cannot count it, because:

  1. I do not know how within the head space (specified by \headheight) the head content is positioned. Do the letters start just where top margin ends? Or is there some additional space?

  2. I do not know, also, how much space below the head baseline is still reserved for the head.

  3. If I would know #2, i could set \headskip so what when the first line height is added (first line height is just the font size, without the leading, right? so 10pt for 10pt document), I should get a multiplication of the grid step size. Yet I'm also not sure if there is no spacing above the the first line of text (is height = dept + font size for the first line?).

BTW: is there some way to display all the boxes created by LaTeX?

  • 1
    This is a long-standing problem: see tex.stackexchange.com/q/57812/17423 and also see tex.stackexchange.com/questions/57812/… – Sean Allred Aug 20 '13 at 19:11
  • At one point in time, I convinced a developer to create a utility which would read the logging information from a file and create a .pdf displaying the boxes --- rather regret leaving the util and contact information at a previous job. – WillAdams Aug 20 '13 at 19:32
  • As @SeanAllred says, it's a long-standing problem. the nearest i've seen to a latex solution was frank mittelbach's paper given at tug2000 (though i think others have worked on the matter since 2000). i was proceedings editor that year, and getting the paper into the output took me some time... i'm told that context has a grid-mode, but i've never tried it. – wasteofspace Aug 21 '13 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.