排除论文中以奇数页开始的某一章

排除论文中以奇数页开始的某一章

我的大学为我的论文提供了一个 LaTeX 模板。在它的类文件中,有一部分代码使所有章节都从奇数页开始。但是,我需要排除其中一章。我该怎么做?

我认为以下是代码的负责任的部分:

\def\@chapter[#1]#2{\BolumSagdaKalsinNolu %"BolumSagdaKalsiNolu" means "let chapters start from the odd-numbered pages"
                    \ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                          \addtocontents{toc}{\protect\addvspace{-10\p@}}
                          \if@appendix
                          \addtocontents{toc}{\protect\addvspace{0\p@}}
                              \addcontentsline{toc}{section}{\protect #1}                                        
                                  \else
                              \addcontentsline{toc}{chapter}{\thechapter. \protect \bf{#1}}
                                  \fi
                    \else
                      \relax
                    \fi
                    \chaptermark{#1}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi
                    }

和:

\def\BolumSagdaKalsinNolu{
  \clearpage
  \if@twoside
    \ifodd
      \c@page
    \else
      \hbox{}
      %\thispagestyle{empty}
      \newpage
      \if@twocolumn
    \hbox{}
    \newpage
      \fi
    \fi
  \fi
} 

我可以添加类似的东西吗?:

if(chapter_name == "blabla")
    don't apply "bolumsagdakalsinnolu"

答案1

您可以简单地添加一个开关,类似于标准书籍类:

\newif\ifopenright\openrighttrue
\def\BolumSagdaKalsinNolu{%
  \clearpage
  \if@twoside
    \ifopenright
      \ifodd
        \c@page
      \else
        \hbox{}
        %\thispagestyle{empty}
        \newpage
        \if@twocolumn
          \hbox{}
          \newpage
        \fi
      \fi
    \fi
  \fi
} 

现在,您可以使用\openrightfalse来停用在奇数页上打开的功能,然后\openrighttrue重新激活它。

report这里有一个包含标准类、您的\@chapter代码和我改编的完整示例\BolumSagdaKalsinNolu

\documentclass[twoside]{report}

\makeatletter
\newif\if@appendix% Added because the code below uses it.
\def\@chapter[#1]#2{\BolumSagdaKalsinNolu %"BolumSagdaKalsiNolu" means "let chapters start from the odd-numbered pages"
                    \ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                          \addtocontents{toc}{\protect\addvspace{-10\p@}}
                          \if@appendix
                          \addtocontents{toc}{\protect\addvspace{0\p@}}
                              \addcontentsline{toc}{section}{\protect #1}                                        
                                  \else
                              \addcontentsline{toc}{chapter}{\thechapter. \protect \bf{#1}}
                                  \fi
                    \else
                      \relax
                    \fi
                    \chaptermark{#1}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi
                    }
\newif\ifopenright\openrighttrue
\def\BolumSagdaKalsinNolu{%
  \clearpage
  \if@twoside
    \ifopenright
      \ifodd
        \c@page
      \else
        \hbox{}
        %\thispagestyle{empty}
        \newpage
        \if@twocolumn
          \hbox{}
          \newpage
        \fi
      \fi
    \fi
  \fi
} 
\makeatother


\begin{document}
\chapter{First chapter}
This should be an odd page.
\chapter{Second chapter}
This should be an odd page.
\openrightfalse
\chapter{Third chapter}
This should be an even page.
\openrighttrue
\chapter{Forth chapter}
This should be an odd page.
\chapter{Fifth chapter}
This should be an odd page.
\end{document}

相关内容