致所有人
之前问过如何为选定的页面添加边框,我得到了答案,但我遇到了问题。我使用了两种类型的页码:罗马和阿拉伯。\AddToShipoutPictureBG{\ifnum\value{page} <3此行将选择页面。边框将同时出现在罗马和阿拉伯页面中。但我只想要罗马页码的页面,而不是阿拉伯页码的页面。所以请帮我做哪些更改...
谢谢
\documentclass[12pt]{book}
\usepackage{tikz}
\usepackage{eso-pic}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathmorphing}
\AddToShipoutPictureBG{\ifnum\value{page}<3
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=3pt]
($ (current page.north west) + (1.5cm,-2.0cm) $)
rectangle
($ (current page.south east) + (-1.5cm,1.8cm) $);
\draw [line width=1pt]
($ (current page.north west) + (1.65cm,-2.15cm) $)
rectangle
($ (current page.south east) + (-1.65cm,1.95cm) $);
\end{tikzpicture}%
\fi}
\begin{document}
\pagenumbering{roman}
\begin{titlepage}
\section*{\large{DECLARATION}}
%-----some paragraph-------
\newpage
\begin{center}
\section*{\large{ACKNOWLEDGEMENT}}
\end{center}
%-----some paragraph-------
\end{titlepage}
\newpage
\tableofcontents
\newpage
\pagenumbering{arabic}
%-----Start chapters-------
\end{document}
答案1
使用\frontmatter
和\mainmatter
:
\documentclass[12pt]{book}
\usepackage{tikz}
\usepackage{eso-pic}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathmorphing}
\makeatletter
\AddToShipoutPictureBG{\if@mainmatter\else
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=3pt]
($ (current page.north west) + (1.5cm,-2.0cm) $)
rectangle
($ (current page.south east) + (-1.5cm,1.8cm) $);
\draw [line width=1pt]
($ (current page.north west) + (1.65cm,-2.15cm) $)
rectangle
($ (current page.south east) + (-1.65cm,1.95cm) $);
\end{tikzpicture}%
\fi}
\makeatother
\begin{document}
\frontmatter
\begin{titlepage}
\section*{\large{DECLARATION}}
%-----some paragraph-------
\newpage
\begin{center}
\section*{\large{ACKNOWLEDGEMENT}}
\end{center}
%-----some paragraph-------
\end{titlepage}
\tableofcontents
\mainmatter
%-----Start chapters-------
\chapter{foo}
\end{document}
答案2
从你的问题来看,不清楚你是想让所有罗马数字页都加上框架,还是只让前两个罗马数字包加上框架。在后一种情况下,最简单的方法是定义新的绘图框架命令,并在这两个页面上插入此命令:
\documentclass[12pt]{book}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\frm{
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=3pt]
($ (current page.north west) + (1.5cm,-2.0cm) $)
rectangle
($ (current page.south east) + (-1.5cm,1.8cm) $);
\draw [line width=1pt]
($ (current page.north west) + (1.65cm,-2.15cm) $)
rectangle
($ (current page.south east) + (-1.65cm,1.95cm) $);
\end{tikzpicture}%
}
\usepackage{lipsum}
\begin{document}
\frontmatter
\begin{titlepage}
\thispagestyle{empty}
\frm
\section*{\large{DECLARATION}}
\lipsum[1]
\clearpage
\thispagestyle{empty}
\frm
\begin{center}
\section*{\large{ACKNOWLEDGEMENT}}
\end{center}
\lipsum[2]
\end{titlepage}
\clearpage
\tableofcontents
\clearpage
\mainmatter
\chapter{Introduction}
\chapter{State of the art}
\end{document}