[Tex/LaTex] How to have different margins on odd and even pages

margins

I want to make a book which has the following specifications for margins for odd and even pages.

enter image description here

How I can do this in letter paper?

Best Answer

This uses geometry to define the paper and set the average margins of each page. Then, the horizontal margins are offset for even and odd pages to get from the average to the target margin. For the vertical margins, I used Heiko's answer at Shift Odd Page in Duplex Print to shift the margin downward on odd pages.

\documentclass[twoside]{article}
% DEFINE PAPER
\usepackage[letterpaper, portrait]{geometry}
\usepackage{lipsum}
%SET AVERAGE MARGIN
\geometry{
left={3.25cm},
right={3.25cm},
top={3.5cm},
bottom={3cm},
}
%SHIFT HORIZONTAL MARGIN ON EVEN/ODD PAGES
  \addtolength\oddsidemargin {0.75cm}
  \addtolength\evensidemargin {-1.25cm}
%SHIFT VERTICAL MARGIN ON ODD PAGES, BASED ON HEIKO'S ANSWER:
%https://tex.stackexchange.com/questions/79688/shift-odd-page-in-duplex-print/79708#79708
\usepackage{atbegshi}
\AtBeginShipout{%
  \ifodd\value{page}%
    \edef\mytemp{%
      \ht\AtBeginShipoutBox=\the\ht\AtBeginShipoutBox\relax
      \dp\AtBeginShipoutBox=\the\dp\AtBeginShipoutBox\relax
    }%
    \sbox\AtBeginShipoutBox{%
      \raisebox{-0.5cm}{\usebox\AtBeginShipoutBox}%
    }%
    \mytemp
  \fi
}
\begin{document}
\lipsum[1-20]
\end{document}