I'm trying to change the margins manually from the file bk10.clo, where I want that in twoside mode the margins are symmetric to 3cm and in oneside mode the margins are top = 3cm, left = 4cm, right = 2cm, bottom = 3cm.
This is my code but I think it's not right.
\if@twocolumn
\setlength\marginparsep {10\p@}
\else
\setlength\marginparsep{7\p@}
\fi
\setlength\marginparpush{5\p@}
\if@compatibility
\setlength\oddsidemargin {.5in}
\setlength\evensidemargin {1.5in}
\setlength\marginparwidth {.75in}
\if@twocolumn
\setlength\oddsidemargin {30\p@}
\setlength\evensidemargin {30\p@}
\setlength\marginparwidth {48\p@}
\fi
\else
\if@twoside
\setlength\@tempdima {\paperwidth}
\addtolength\@tempdima {-\textwidth}
\setlength\oddsidemargin {.4\@tempdima}
\addtolength\oddsidemargin {-1in}
\addtolength\oddsidemargin {-0.3in} % we add -0.3in to get 3cm of left side margin
\setlength\marginparwidth {.6\@tempdima}
\addtolength\marginparwidth {-\marginparsep}
\addtolength\marginparwidth {-0.4in}
%\addtolength\textwidth {1.36in} % we add 1.36in to get 3cm of right side margin
\else
\setlength\@tempdima {\paperwidth}
\addtolength\@tempdima {-\textwidth}
\setlength\oddsidemargin {.5\@tempdima}
\addtolength\oddsidemargin {-1in}
\addtolength\oddsidemargin {-0.28in} % we add -0.28in to get 4cm of left side margin
\setlength\marginparwidth {.5\@tempdima}
\addtolength\marginparwidth {-\marginparsep}
\addtolength\marginparwidth {-0.4in}
\addtolength\marginparwidth {-.4in}
%\addtolength\textwidth {1.36in} % we add 1.36in to get 2cm of right side margin
\fi
\addtolength\textwidth {1.36in} % we add 1.36in to get 3cm (resp. 2cm) of right side margin in mode twoside (resp. mode oneside).
\ifdim \marginparwidth >2in
\setlength\marginparwidth{2in}
\fi
\@settopoint\oddsidemargin
\@settopoint\marginparwidth
\setlength\evensidemargin {\paperwidth}
\addtolength\evensidemargin{-2in}
\addtolength\evensidemargin{-\textwidth}
\addtolength\evensidemargin{-\oddsidemargin}
\@settopoint\evensidemargin
\fi
\if@compatibility
\setlength\topmargin{.75in}
\else
\setlength\topmargin{\paperheight}
\addtolength\topmargin{-2in}
\addtolength\topmargin{-\headheight}
\addtolength\topmargin{-\headsep}
\addtolength\topmargin{-\textheight}
\addtolength\topmargin{-\footskip} % this might be wrong!
\addtolength\topmargin{-.5\topmargin}
\addtolength\topmargin{-0.56in} % we add -0.56in to get 3cm of top margin
\addtolength\textheight{1in} % we add 1in to get 3cm of bottom margin (from the limit of the page at body)
\addtolength\footskip{0.066in} % we add 0.066in to get 2cm of bottom margin (from the limit of the page at footer)
\@settopoint\topmargin
\fi
Thanks in advance.
EDIT: Using
\makeatletter
\setlength{\oddsidemargin}{-1in}
\if@twoside
\addtolength{\oddsidemargin}{3cm}
\else
\addtolength{\oddsidemargin}{4cm}
\fi
\setlength{\evensidemargin}{\oddsidemargin}
\setlength{\textwidth}{\paperwidth}
\addtolength{\textwidth}{-6cm} % left+ right margins
\setlength{\topmargin}{-1in}
\addtolength{\topmargin}{-\headheight}
\addtolength{\topmargin}{-\headsep}
\addtolength{\topmargin}{3cm}
\setlength{\textheight}{\paperheight}
\addtolength{\textheight}{-6cm} % top + bottom margins
\makeatother
I appreciate any help...
tex-core
when it seems to have nothing to do with it?-0.3in
get you3cm
left of anything? You are 0.3in to the left of the left edge of the paper as far as I can tell. However, without complete code, it is hard to say. Add\usepackage[pass,verbose]{geometry}
to see what's happening. Better yet, usegeometry
to do it.geometry
. There is no point in reinventing the wheel.