The margin indicated in the picture below is the clearance I am referring to. I already have pre-specified left margin, horizontal margin ratio, binding offset and marginsep. I want LaTeX to calculate marginparwidth such that the clearance shown below (the clearance from the page edge to the paragraph margin) will have a prespecified value, say 10mm. With the given parameters, the value is 35mm, but I want this value to be calculated automatically rather than set by trial and error

enter image description here

My source code


    \geometry{twoside=true, showframe=true}

        % Horizontal
        \geometry{marginparsep=5mm, marginparwidth=35mm}

        % Vertical
        \geometry{headheight=8pt, headsep=14pt} 


Document Text


Like this?

possible target


\geometry{verbose, showframe}

% Horizontal
\geometry{inner=20mm,hmarginratio=2:5,outer=10mm,includemp=true, marginparsep=5mm}% includemp=true means that the calculation includes the space for marginal notes into the area allocated to text, rather than to the area allocated to the margins i.e. marginalia are no longer in the margin, strictly speaking. The effect of this is that outer specifies the width of the gap between the end of (text block and marginalia) and the paper edge, which is what you seem to want. In this case, either inner or hmarginratio is redundant, but I've left both as I don't know which you actually want. (The value of hmarginratio gives you an inner margin of 25mm rather than 20mm, I think.)

% Vertical
\geometry{top=20mm,vmarginratio=2:3,headheight=8pt, headsep=14pt,footskip=24pt}% note that headheight is too small unless you are using a very small font for the header or not using a header at all. If you use `fancyhdr` read the console output to see what you need instead, else you'll get inconsistent page layout.


Document Text

| improve this answer | |
  • Off-topic: one of the '4 yes': Use geometry :). – manooooh Aug 26 '18 at 3:39
  • @Al-MotasemAldaoudeyeh I voted to reject the edit you proposed because it looked too substantial to me. If you feel that the information is necessary, you can add an answer of your own, leave a comment here or ask cfr to include it in her answer. – moewe Aug 26 '18 at 7:42
  • @moewe. cfr had given the correct answer, but without explaining why it worked. I understood what happened, but novice users may not be able to know why it had worked. – Al-Motasem Aldaoudeyeh Aug 26 '18 at 7:47
  • 1
    @Al-MotasemAldaoudeyeh But putting words into another user's mouth should only be done as a last resort I think, especially in this case where the answer is quite new (and not community wiki). Since the changes were pretty significant I voted to reject them. – moewe Aug 26 '18 at 7:53

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.