混合使用 \pagestyle 和 \newpage 和 \marginenote 时出现异常行为

混合使用 \pagestyle 和 \newpage 和 \marginenote 时出现异常行为

这可能是一个新手问题,但我已经努力了几个小时才弄清楚发生了什么,但仍然没有任何意义。

我设法创建了一个 MWE,但是当我逐渐转向实际案例时,一切都崩溃了。

我在多个文件中使用了相对复杂的 Latex。请考虑以下主程序:

http://pastebin.com/CCXJJzpR

    \documentclass[a4paper,twoside,12pt,british]{report}

%DEBUG variable will be used to provide extra information as a margin note!
\newif\ifDEBUG 
\DEBUGtrue

\author{MEEE }
%\title{Minimal PhD}
\title{\ifDEBUG\marginnote{DE-BUG mode!!!!}[1cm]\fi Big title}

\usepackage[LGR,T1]{fontenc}
\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}


\usepackage[a4paper]{geometry}
\usepackage{marginnote}


\usepackage{subfiles} %for multiple files
%\usepackage[sectionbib]{chapterbib}

\usepackage{syntonly}
%\syntaxonly %when commented out, it DOES produce pdf file.


\usepackage{xcolor,graphicx,epstopdf} %for colour in images, for images, for auto-conversion
\usepackage{ifpdf}


\usepackage{color}
\usepackage[UKenglish, british]{babel}
\usepackage{hyphenat} %to hypen words in the text, use \hyp{} instead of direct -
\usepackage{verbatim}
\usepackage{nomencl}
% the following is useful when we have the old nomencl.sty package
\providecommand{\printnomenclature}{\printglossary}
\providecommand{\makenomenclature}{\makeglossary}
\makenomenclature

\usepackage[unicode=true,pdfauthor={meee}, pdftitle={ pdffffftitle },  pdftex,  bookmarks=true, bookmarksnumbered=true, bookmarksopen=true, bookmarksopenlevel=1, breaklinks=true,pdfborder={0 0 1}, colorlinks=true, backref=page]{hyperref}

\newif\ifpdf
\ifx\pdfoutput\undefined
    \pdffalse
\else
    \pdfoutput=1
    \pdftrue
\fi

\ifpdf
  % put here packages only for the PDF:
  \DeclareGraphicsExtensions{.pdf,.png,.jpg,.mps}   
  \DeclareGraphicsRule{.eps}{pdf}{.pdf}{`epstopdf #1} %\includegraphics[width=7in]{result_1} %without extension
  \hypersetup{linkcolor=blue}
\else
% put here packages only for the DVI:
    \hypersetup{linkscolors=black}
\fi

\makeatletter

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
    \DeclareRobustCommand{\greektext}{%
      \fontencoding{LGR}\selectfont\def\encodingdefault{LGR}}
    \DeclareRobustCommand{\textgreek}[1]{\leavevmode{\greektext #1}}
    \DeclareFontEncoding{LGR}{}{}
    \DeclareTextSymbol{\~}{LGR}{126}
    %% Because html converters don't know tabularnewline
    \providecommand{\tabularnewline}{\\}

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
    \newcommand{\lyxaddress}[1]{
    \par {\raggedright #1
    \vspace{1.4em}
    \noindent\par}
    }

    \@ifundefined{showcaptionsetup}{}{%
    \PassOptionsToPackage{caption=false}{subfig}}
    \usepackage{subfig}
\makeatother





%headers

\usepackage{fancyhdr}
\pagestyle{headings}

%\pagestyle{myheadings} % use page headers
% puts headers on both pages alternating even and odd numbers.  \markboth{even-text}{odd-text}
%\markboth{Modular Examples for LaTeX, August 2008, Assad Ebrahim}{(Odd Numbered Pages), (Additional Text), (Final Text)}

%
%\makeatletter
%\def~\ref{\clearpage%
%\if@twoside
%\ifodd\c@page\else
%\vspace*{\fill}
%\hfill
%\begin{center}
%This page intentionally left blank.
%\end{center}
%\vspace{\fill}
%\thispagestyle{empty}
%\newpage
%\if@twocolumn\hbox{}\newpage\fi
%\fi
%\fi
%}
%\makeatother


%second version of intentially empty page
\newcommand*{\blankpage}{%
    \vspace*{\fill}%
    %\centering 
    \textit{This page is intentionally left blank for formatting purposes.}%
    \vspace{\fill}%
}

\makeatletter%
    \renewcommand*{\cleardoublepage}{
        \clearpage
        \if@twoside
            \ifodd
                \c@page
            \else
                \blankpage
            %   \thispagestyle{empty}
                \newpage
                \if@twocolumn
                    \hbox{}
                    \newpage
                \fi
            \fi
        \fi
        \pagestyle{headings}
    }
\makeatother



\newcommand*\NewPage{%
\newpage\null\thispagestyle{empty}\newpage%
}


\newcommand*\myblankpage{
    \newpage
    \thispagestyle{empty}
    \textit{This page is intentionally left blank for formatting purposes.}%
    \null
    \pagebreak

}

%\newcommand*\NewPage{\newpage\null\thispagestyle{empty}\newpage}

\begin{document}


\maketitle





\myblankpage





\begin{center}
Dissertation (Full Time PhD)\\
\vspace{4cm}

\par\end{center}

\begin{center}
{\LARGE{}Meeeeee}\vspace{4cm}

\par\end{center}

\begin{center}
Supervised by
\par\end{center}

\begin{center}
Somebody
\bigskip{}

\par\end{center}

\begin{center}
Date of initial registration: past
\par\end{center}

\begin{center}
Date of Review Meeting: \textbf{now}
\par\end{center}


\lyxaddress{\begin{center}
Venue: \textbf{10:00am in space} 
\par\end{center}}

\newpage{}


Month... 2014

\newpage{}




\begin{flushright}
2014
\par\end{flushright}

\newpage{}




\subsection*{Declaration}

This dissertation is the result of my own work and othe stuff
\vspace{2cm}







\newpage{}


\section*{Acknowledgements}

The research has been carried out somewhere

\newpage{}

\subfile{abstract}

\newpage{}

\tableofcontents{}
\listoffigures
\listoftables

\newpage{}

\settowidth{\nomlabelwidth}{EUROCONTROL}
\printnomenclature{}

\newpage{}





\subfile{phd_1_problem_description}

\subfile{phd_2_literature_review}

\subfile{phd_3_technical_report}

\subfile{phd_4_methodology_families}

\subfile{phd_5_applications}

\subfile{phd_6_conclusions}


\appendix
\addcontentsline{toc}{chapter}{Appendix}
\subfile{appendix_1}
\subfile{appendix_2}

\newpage{}

\bibliographystyle{plain}
\phantomsection\addcontentsline{toc}{chapter}{\bibname}\bibliography{biblio}

\end{document}

摘要如下:

http://pastebin.com/X0fxdQRH

    \documentclass[phd_dissertation_master2.tex]{subfiles} 



    \begin{document}

    \begin{abstract}




    \ifDEBUG
        \marginnote{Problem Description}[0cm]
    \fi

    any random text any random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textvvvvvvvv


    \ifDEBUG
        \marginnote{How to address the problem}[0cm]
    \fi

    random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textany random textvvvvvvvv






    \end{abstract}

    \end{document}

pdflatex 上的所有内容都编译得很好,但最终输出并不完全正确。更准确地说,当我包含命令 \newline 时,边注与正文相交。我无意中从 MWE 中反复试验发现了这一点。如果我不使用它,那么一切都很好。如果包含它,则会出现上述错误。我试图做的就是创建一个命令,它会在偶数页上留下一条消息(标准消息“此页故意留空”)。

在此处输入图片描述

我对文档的其余部分感到满意​​,我只需要包含那个次要行为。不幸的是,它产生了巨大的影响并破坏了我的结构。

我认为问题出在软件包的混合上:

fancyhdr marginnote 子文件

但从他们的描述来看,并没有发现任何已知的不良行为。

有什么建议么?

我试图在文本的每个元素周围打印任何框,但我也找不到。

按照 Jared 的建议后,打印布局如下:

在此处输入图片描述

在此处输入图片描述

在我看来它们非常好。

更新:下面的代码更简洁,但仍然重现了不良行为。因为它提供了重叠输出。如果您注释掉 \newpage 并注释掉 \cleardoublepage,它似乎可以正常工作。

    \documentclass[a4paper,twoside,12pt]{report}

    \newif\ifDEBUG 
    \DEBUGtrue
    %\DEBUGfalse

    \usepackage[a4paper]{geometry}
    \usepackage{marginnote}

    \usepackage{layout} 

    \usepackage[LGR,T1]{fontenc}
    \usepackage[utf8]{inputenc} 

    \usepackage{subfiles} 

    \usepackage[UKenglish]{babel} 

    \newcommand*{\blankpage}{%
        \vspace*{\fill}%     
        \textit{This page is intentionally left blank more complicated}%
        \vspace{\fill}%
    }

    \makeatletter
        \renewcommand*{\cleardoublepage}{
            \clearpage
            \if@twoside
                \ifodd
                    \c@page
                \else
                    \blankpage
                    \thispagestyle{empty}
                    \newpage
                    \if@twocolumn
                        \hbox{}
                        \clearpage
                    \fi
                \fi
            \fi
            \pagestyle{headings}
        }
    \makeatother



    \begin{document} 
    \layout 
    \cleardoublepage


    \ifDEBUG
        \marginnote{BEFORE Abstract first marginnote for demonstration}[0cm]
    \fi


    some random text some random text some random text some random text some random text some random text some random text some random text some
     random text some random text some random text some random text some random text some random text some random text some random text some random

    \newpage

    %\cleardoublepage

    \begin{abstract}

    \ifDEBUG
        \marginnote{in Abstract first marginnote for demonstration}[0cm]
    \fi

    some random text some random text some random text some random text some random text some random text some random text some random text some
     random text some random text some random text some random text some random text some random text some random text some random text some random

    \end{abstract}

    \cleardoublepage

    Start main text

    \ifDEBUG
        \marginnote{first marginnote in MAIN for demonstration}[0cm]
    \fi

    some random text some random text some random text some random text some random text some random text some random text some random text some
     random text some random text some random text some random text some random text some random text some random text some random text some random


    \ifDEBUG
        \marginnote{second marginnote in MAIN for demonstration}[0cm]
    \fi

    some random text some random text some random text some random text some random text some random text some random text some random text some
     random text some random text some random text some random text some random text some random text some random text some random text some random

    \cleardoublepage

    \ifDEBUG
        \marginnote{third marginnote in MAIN for demonstration}[0cm]
    \fi

    some random text some random text some random text some random text some random text some random text some random text some random text some
     random text some random text some random text some random text some random text some random text some random text some random text some random

    \end{document}

欢迎提出任何意见/建议。提前致谢,C。

相关内容