# Unable to set page size and trims correctly in memoir class

My apologies for being a newbie with memoir. This is what I am trying to do. But it text cuts across trims, and far beyond the area it should occupy. Trims do not seem to be correct either. Would appreciate any help.

Vikas

\documentclass[11pt,a4paper,twoside,openright,showtrims]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\tolerance=1000
\usepackage{float}
\usepackage{caption}
\usepackage{color,graphicx}
\trimFrame
\settrimmedsize{21cm}{13.8cm}{*}
\settypeblocksize{48.36942pt}{31.29786pt}{*}
\setlength{\trimtop}{0pt}
\setlength{\trimedge}{\stockwidth}
\setlrmargins{*}{3.1cm}{*}
\setulmargins{4.5\onelineskip}{*}{*}
\chapterstyle{veelo}
\pagestyle{ruled}
\checkandfixthelayout[lines]
\usepackage[dvipsnames,svgnames,table]{xcolor}

\usepackage{comment,multirow,tabulary,booktabs,threeparttable,tabularx,xcolor,lmodern,graphicx,longtable,float,wrapfig,url,underscore}
\usepackage{pdflscape}
\usepackage[backgroundcolor=gray!40,roundcorner=8pt,skipabove=10pt,skipbelow=10pt,leftmargin=10pt,rightmargin=10pt]{mdframed}
\newcounter{infobox}[chapter]
\renewcommand{\theinfobox}{\thechapter.\arabic{infobox}}
\newenvironment{infobox}[1][]{%
\refstepcounter{infobox}
\begin{mdframed}[%
frametitle={Box \theinfobox\ #1},
skipabove=\baselineskip plus 2pt minus 1pt,
skipbelow=\baselineskip plus 2pt minus 1pt,
linewidth=0.5pt,
frametitlerule=true,
repeatframetitle=true,
frametitlebackgroundcolor=gray!30
]%
}{%
\end{mdframed}
}
\usepackage{parnotes,comment,multirow,amsmath,amssymb,marvosym,wasysym}
\usepackage[T1]{fontenc}
\usepackage[normalem]{ulem}
\usepackage[citestyle=authoryear-icomp,bibstyle=authoryear,hyperref=true,maxcitenames=3,url=true,backend=biber,natbib=true]{biblatex}
\usepackage[version=3]{mhchem}
\usepackage[innermargin=1.5in,outermargin=1.25in,vmargin=1.25in]{geometry}
\usepackage[below]{placeins}
\newcounter{box}[section]
\setcounter{secnumdepth}{2}
\date{}
\title{Title of the Book?}

\begin{document}

\begin{titlingpage}
\maketitle
\end{titlingpage}

\tableofcontents

\chapter{Memoir with Trim}

\section{First section}

\lipsum

\chapter{Second Chapter}

\lipsum

\end{document}

• It would be helpful if you could trim this document down to the minimum required to show the problem. You are loading all sorts of packages that are not relevant to the issue at hand. As a first look, why are you using both geometry and memoir to set the page size? Just use memoir. – Alan Munn Mar 23 '15 at 4:46
• I did not remove those packages from being loaded thinking that some of them may be causing a conflict. Perhaps geometry it is. Let me remove that and see. – len71 Mar 23 '15 at 5:55
• Actually, removing packages one at a time and seeing if the problem persists is a standard debugging technique. – John Kormylo Mar 23 '15 at 16:14