I would like to embed a pdf document (few pages) in my latex document. However, I use the geometry package to set the margins and when I load \usepackage{pdfpages} it completely destroys all my margins.
I have:
\usepackage[a4paper, twoside, scale={1,1},
hmargin={3.3cm, 2.7cm},
vmargin={2cm, 4.5cm},
headsep=0.5cm]{geometry}
when I use \usepackage{pdfpages} then it changes all my margin and my document looks like the attached image . Basically using the pdfpages shifts my texts to header section.
I would appreciate if someone tells me how to resolve this issue.
here is a MWE (minimum working example). It does not show the exact error but you see if you comment line 83 (\usepackage{pdfpages}) the margins are different. Note that I do not even use \includepdf yet.
\documentclass[11pt,a4paper,twoside]{report} %physics
\usepackage[dvips]{graphicx}
\usepackage{setspace}
\usepackage{fancyhdr, lastpage}
\pagestyle{fancy}
\usepackage{nomencl}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{parskip}
\usepackage{hyperref}
\usepackage{titlesec}
\usepackage{xcolor,colortbl}
\usepackage{blindtext}
\definecolor{darkblue}{rgb}{0.0,0.0,0.0} %{0.0,0.0,0.3}
\hypersetup{colorlinks,breaklinks,
linkcolor=darkblue,urlcolor=darkblue,
anchorcolor=darkblue,citecolor=darkblue,
pdftitle = {Test Procedure: Tank Testing},
pdfauthor = {Ashkan}}
\renewcommand{\nomentryend}{\vspace{-8pt}}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
%%%To be able to have smaller fonts
\newcommand{\changefont}{%
\fontsize{8}{11}\selectfont
}
%%%To be able to have larger fonts
\newcommand{\changefonttitle}{%
\fontsize{12}{11}\selectfont
}
%%%%%%%%%%%%%%%%%%
\titleformat{\chapter}
{\normalfont\LARGE\bfseries}{\thechapter.}{0.5em}{}
\titlespacing*{\chapter}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%Creating a new colour Light Blue for the table on the front page
\definecolor{LightBlue}{rgb}{0.3,0.6,1.0}
%%%To have headers/footers on the title page
\fancypagestyle{empty}{%
\renewcommand{\headrulewidth}{0.4pt}%
\fancyheadoffset{0.0cm}
\fancyfootoffset{0.0cm}
\renewcommand{\footrulewidth}{0.4pt}
\fancyhf{}%
\fancyhead[L]{\changefont {\textsc{TEST PROCEDURE -- TANK TESTING}}}
\fancyhead[R]{\includegraphics[scale=0.3]{./logo.png}}
\fancyfoot[C]{\changefont{\color{red}{CONFIDENTIAL -- COMERCIAL IN CONFIDENCE \\ THIS DOCUMENT IS UNCONTROLLED WHEN PRINTED}} }%
}
%%%To have headers/footers on the pages that are using plain template
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{0.4pt}%
\fancyheadoffset{0.0cm}
\fancyfootoffset{0.0cm}
\renewcommand{\footrulewidth}{0.4pt}
\fancyhf{}%
\fancyhead[L]{\changefont {\textsc{TEST PROCEDURE -- TANK TESTING}}}
\fancyhead[R]{\includegraphics[scale=0.3]{./logo.png}}
\fancyfoot[C]{\changefont{\color{red}{CONFIDENTIAL -- COMERCIAL IN CONFIDENCE \\ THIS DOCUMENT IS UNCONTROLLED WHEN PRINTED}}\\}%
\fancyfoot[RE, RO]{Page {\thepage} of \pageref{LastPage}}
}
\makeglossary
%%%%%%%%%%%%% Mike's section %%%%%%%%%%%%%%%%%%%%%%%
\usepackage[a4paper, twoside, scale={1,1},
hmargin={3.3cm, 2.7cm},
vmargin={2cm, 4.5cm},
headsep=0.5cm]{geometry}
\onehalfspacing
\usepackage{pdfpages}
%%%%%%%%%%%%% end of mike's section %%%%%%%%%%%%%%%%
\begin{document}
\title{
\textsc{\\*[-2cm] Test Procedure \\ Tank Testing}
}
\author{}
\date{\raggedright}
\maketitle
\thispagestyle{empty}%
\pagenumbering{roman}%
\setcounter{secnumdepth}{-1}%
\thispagestyle{empty}%
\tableofcontents
\clearpage%
%--------------------------------------------------------------------------
\pagenumbering{arabic} \setcounter{secnumdepth}{3}
\pagestyle{fancy}%
\fancyheadoffset{0.0cm}
\fancyfootoffset{0.0cm}
\renewcommand{\headrulewidth}{0.4pt}%
\renewcommand{\footrulewidth}{0.4pt}
\fancyhf{}%
\fancyhead[L]{\changefont {\textsc{Specification -- Tank Testing Model}}
\fancyhead[R]{\includegraphics[scale=0.3]{./logo.png}}
\fancyfoot[C]{\changefont{\color{red}{CONFIDENTIAL -- COMERCIAL IN CONFIDENCE \\ THIS DOCUMENT IS UNCONTROLLED WHEN PRINTED}}\\}%
\fancyfoot[RE, RO]{Page {\thepage} of \pageref{LastPage}}
%%%%%%%%%%%%Chapters (Contents of the document)%%%%%%%
%------------------------------------------------------------------------------------------
\blindtext[10][10]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
to run you need this save it in the same folder as logo.png.
blindtext
.siunitx
. It makes typesetting units much easier and consistent (ensures that they are upright).