The minitoc package adds extra page when used with float and lastpage packages. I figured out that this problem can be resolved by loading minitoc package before float and lastpage packages. In LyX the float package is loaded automatically and could not figure out how to force LyX use minitoc package before loading float and lastpage packages. Thanks in advance for your help.
\documentclass[a4paper,12pt]{book}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{float}
\usepackage{minitoc}
\begin{document}
\dominitoc
\tableofcontents
\mainmatter
\chapter{First Chapter}
\minitoc
\section{Introduction}
\blindtext[1]
\section{Material \& Method}
\blindmathpaper
\chapter{Second Chapter}
\minitoc
\section{Introduction}
\blindtext[1]
\section{Material \& Method}
\blindmathpaper
\end{document}
Edited
It is also working in LyX 2.1.1 if I remove \includepdf[pages={1},scale=1]{Back.pdf} at the end of the document. However if I include \includepdf[pages={1},scale=1]{Back.pdf} at the end of the document it adds extra page. Any thoughts.
Updated
I've narrow downed the problem. My following MWE in .Rnw format adds extra page at the end of document when using minitoc package. Thanks again for your help.
\documentclass[a4paper,12pt]{book}
\usepackage{minitoc}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{float}
\usepackage{pdfpages}
\begin{document}
\dominitoc
\tableofcontents
\mainmatter
\chapter{First Chapter}
\minitoc
\section{Introduction}
<< Test >>=
1:50
@
\blindtext[1]
\section{Material \& Method}
\blindmathpaper
\includepdf[pages={1},scale=1]{Back.pdf}
\end{document}
minitocbeforelastpageonly (floatcan be loaded before of after), and since apparently LyX only loadsfloat, then you shouldn't have any troubles; simply loadminitocbeforelastpage. – Gonzalo Medina Aug 01 '14 at 15:27minitocbeforelastpagesolves it. Doesn't it? – Gonzalo Medina Aug 01 '14 at 15:34minitocbeforelastpagesolves the issue inLaTeXbut not inLyX. – MYaseen208 Aug 01 '14 at 15:39floatautomatically, notlastpage, solastpageshould not be a problem. – Gonzalo Medina Aug 01 '14 at 15:42LyX 2.1.1. – MYaseen208 Aug 01 '14 at 15:45LyX 2.1.1if I remove\includepdf[pages={1},scale=1]{Back.pdf}. However if I include\includepdf[pages={1},scale=1]{Back.pdf}it adds extra page. Any thoughts. – MYaseen208 Aug 01 '14 at 16:27