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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I want to do is calculate the actual size between the edge of the paper, and my header. \evenmarginsize and \oddmarginsize do not do this.

\settowidth{\msize}{((\paperwidth - \textwidth)/2)}

Doesn't seem to work, how can this be done?

share|improve this question
1. You don't say which edge of the paper. On first reading, because you are talking about the header, I thought the top edge. 2. The commands \evenmarginsize and \oddmarginsize don't exist. Perhaps you meant \oddsidemargin and \evensidemargin. 3. \settowidth takes a piece of text and calculates its width. For what you want, use \setlength and you need the calc package to use algebraic notation. 4. One more thing: supply a compilable file that shows what you tried. – Dan Dec 9 '13 at 3:13
1) The left hand side, when I first tried this I didn't think it mattered. 2) Yes, those are the correct commands. My memory mixed them up. 3) Below is a solution without calc. 4) Didn't need to. Oh, and one more thing, calm the attitude Mr. Keyboard Warrior. – NictraSavios Dec 9 '13 at 8:41
up vote 8 down vote accepted

Use the e-TeX structure:


The macro \settowidth is used with finding the width of a portion of text such as in:

 \settowidth{\mytextwidth}{This is some text whose width I'm measuring}

The documentation can be found by running texdoc etex from the command line. Amoung other things, e-TeX provides several nice commands to facilitate calculations using \dimexpr, \numexpr, and several other flavors. Since I've discovered these, I find I don't use the calc package that much anymore.

share|improve this answer
Documentation Please :)! – NictraSavios Dec 8 '13 at 19:54



However, I recommend you looking at the hcentering option of the package geometry.

share|improve this answer
Not trying to centre the header. – NictraSavios Dec 8 '13 at 19:55
Well, you obviously do some calculation of the page geometry. I only suggest that you might have a look at the package above, because you might save yourself a lot of time not doing something that has been done before ;) – yo' Dec 8 '13 at 19:56
Haha I checked it out, it wasn't what I wanted. Thank you though – NictraSavios Dec 9 '13 at 8:43

Your Answer


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.