\setlength\maintitleHeight{\ht\maintitleBox + \dp\maintitleBox}%


The maintitle is supposed to go above the text area on some pages. What I am trying to do is to save the height of the box and move the box up by exactly the height of the box.

However, I can't get it to work. What am I missing?

Edit: Would I have been more committed to testing, I would have seen that \maintitleHeight is only the height of the text; not of the rule below. Now the question is: why is that and how can I fix this?

  • 3
    You should always post a complete (but minimal) document that reproduces the problem, not a fragment that no one can run, but \ht\maintitleBox + \dp\maintitleBox is a syntax error unless you have loaded the calc package (it would be clear what packages were in use in a complete document) Mar 14, 2016 at 9:38
  • I am sorry, I was in a hurry. Added an MWE.
    – chaosflaws
    Mar 14, 2016 at 15:47
  • Do you just want to move content into the header? For that you can use a header package like fancyhdr (while you're using a KOMA-script class, you're not using any of its functionality, so I doubt it's really in-use).
    – Werner
    Mar 14, 2016 at 17:00

2 Answers 2


If your aim is to make the heavy rule sitting at the top of the text area, no measuring is needed:






Some text follows


enter image description here

  • +1 but as you can see the vertical position of "Some text follows" is shifted. Something like \vspace{\dimexpr-\baselineskip+\topskip}% below the \parbox is needed.
    – user4686
    Mar 15, 2016 at 8:31
  • @jfbu I don't think this should be much of a concern: I hope some vertical space follows the title anyway.
    – egreg
    Mar 15, 2016 at 8:33
  • It the rule was positioned a bit higher, maintaining same vertical position for main text could become more attractive. Particularly if the top rule is only for certain pages.
    – user4686
    Mar 15, 2016 at 17:12

It isn't really clear what you want to do, \parbox is vertically centred by default and your box has

> \box29=
.\pdfcolorstack 0 push {0 g 0 G}
..\hbox(7.48248+0.0)x418.25555, glue set 397.81555fil []
..\glue(\parskip) 0.0
..\glue(\baselineskip) 10.75475
..\hbox(2.84526+0.0)x418.25555 []
.\pdfcolorstack 0 pop

so it has one line of text and then the rule, although only 1mm high adds another 12pt being \baselineskip to the overall height+depth of the box.

At the top of the page you have

...\glue(\topskip) 11.0

% setting for the first baseline in this class

...\penalty 10000
...\glue -21.08249

% the negative space you added

...\glue 0.0
...\glue(\parskip) 0.0 plus 1.0

% parskip before the \usebox (which might stretch)

...\glue(\baselineskip) 0.32127

% baselineskip to make up 13.6pt together with the height of your box.


% the \usebox

  • "\parbox is vertically centred by default" Thanks, this was part of the problem. I remembered incorrectly default would be [t]. How did you get the output you posted?
    – chaosflaws
    Mar 16, 2016 at 7:44
  • 1
    @chaosflaws \showoutput for the page layout and \showbox for the specific box. Mar 16, 2016 at 14:38

Your Answer

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

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