我想对罗马数字页面设定一些条件,对阿拉伯数字页面设定另一个条件。(我想知道如何从两个编号类别中的特定页面中删除背景)。
\AddEverypageHook{%
\ifnum\value{page}>0
\ifodd\value{page}\relax%
\backgroundsetup{% settings for odd-numbered pages
angle=0,
contents={\begin{tikzpicture}[remember picture,overlay]
\node at ([yshift=0cm,xshift=-9.7cm]current page) {\includegraphics[scale=1.10] {Margin2.png}}; %% yshift and xshift for example only
\end{tikzpicture}}
}%
\else
\backgroundsetup{% settings for even-numbered pages
angle=0,
contents={\begin{tikzpicture}[remember picture,overlay]
\node at ([yshift=0cm,xshift=9.7cm]current page) {\includegraphics[scale=1.10]{Margin2.png}}; %% yshift and xshift for example only
\end{tikzpicture}}
}%
\fi%
\BgMaterial
\fi}
编辑:
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{empty} %No headings for the first pages.
%% front setting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input{pg}
\cleardoublepage
\pagenumbering{Roman}
\pagestyle{empty}
\tableofcontents %Table of contents
\chapter*{\textbf{Introduction}}
\pagenumbering{arabic}
\addcontentsline{toc}{chapter}{Introduction}
\thispagestyle{plain}
\large BLA BLA.
\end{document}
我想从主页中删除背景,我想知道如何从特定页面中删除背景。\NoBgThispage 在这里不起作用
答案1
很抱歉,但我不明白您到底想对您的情况做什么,所以我无法提供 MWE。
无论如何,实现您想要的目标的一个简单方法是定义一个新的“if”。在序言中添加此行:
\newif\ifroman\romanfalse
然后按如下方式修改\AddEverypageHook
命令:
\AddEverypageHook{%
\ifroman
% add whatever you want to be printed when page numbering is roman
\else
% add whatever you want to be printed when page numbering is not roman (e.g. arabic)
\fi
}
此时,当您在文档中定义页码时,请按如下方式操作:
\pagenumbering{Roman}\romantrue
当你需要罗马数字时,
\pagenumbering{arabic}\romanfalse
当您需要阿拉伯数字时。
答案2
如果您使用标准\pagenumbering
宏进行切换Roman
,或者roman
您可以使用代码中定义的宏
\ifroman
对于小写罗马数字,\ifRoman
大写罗马数字,以及\ifRroman
任何罗马数字。
它们必须与参数一起使用,例如
\ifRroman{<true>}{<false>}
代码
\documentclass{article}
\makeatletter
\def\thepage@Roman{\csname @Roman\endcsname\c@page}
\def\thepage@roman{\csname @roman\endcsname\c@page}
\def\ifroman{\ifx\thepage\thepage@roman\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\def\ifRoman{\ifx\thepage\thepage@Roman\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\def\ifRroman{%
\ifx\thepage\thepage@Roman
\expandafter\@firstoftwo
\else
\ifx\thepage\thepage@roman
\expandafter\expandafter\expandafter\@firstoftwo
\else
\expandafter\expandafter\expandafter\@secondoftwo
\fi
\fi}
\makeatother
\begin{document}
\ifroman{roman}{not roman} :
\ifRoman{Roman}{not Roman} :
\ifRroman{Rroman}{not Rroman}
\pagenumbering{roman}
\ifroman{roman}{not roman} :
\ifRoman{Roman}{not Roman} :
\ifRroman{Rroman}{not Rroman}
\pagenumbering{Roman}
\ifroman{roman}{not roman} :
\ifRoman{Roman}{not Roman} :
\ifRroman{Rroman}{not Rroman}
\end{document}