样例代码如下:
\documentclass[twocolumn]{scrbook} \usepackage{fontspec} \setmainfont{Linux Biolinum O} \usepackage{polyglossia} \setmainlanguage{italian} % ------------------------------------------------- % page layout:\setlength\parindent{15pt} \usepackage[a4paper]{geometry} \newlength\imargin \newlength\omargin \setlength\imargin{.7in} \setlength\omargin{.7in} \geometry{ inner = \imargin , outer = \omargin , top = 1in , bottom = .7in } % ------------------------------------------------- % colors:\usepackage{tikz,xcolor} \usetikzlibrary{positioning} \definecolor{darkred}{cmyk}{0.0,0.87,0.87,0.50} \colorlet{mygray}{black!20} % ------------------------------------------------- % header and footer:\usepackage{scrpage2} \pagestyle{scrheadings} \renewcommand*\chapterpagestyle{scrheadings} \clearscrheadfoot \newcommand*\logo{% \textcolor{darkred}{\scalebox{1.3}{ITALIAN} \scalebox{2}{SRD}} \\ d20\scalebox{2}{MODERN}} \tikzset{ logo/.style={ color = mygray , font = \normalfont\sffamily\Large\bfseries , inner sep = .25in , align = center }, page/.style={ color = mygray , fill = darkred , font = \normalfont\sffamily\Huge\bfseries , minimum size = \omargin-.2in , yshift = 2in }, chapter/.style={ color = mygray , scale = 1.5 , transform shape , font = \normalfont\sffamily\Huge\bfseries , } } \ohead{ \begin{tikzpicture}[remember picture, overlay] % logo:\ifthispageodd {\node[below left,logo] at (current page.north east)} {\node[below right,logo] at (current page.north west)} {\logo} ; % page number:\ifthispageodd {\node[left,page] at (current page.east)} {\node[right,page] at (current page.west)} {\thepage} ; % chapter mark:\ifthispageodd {\node[anchor=north east,rotate=-90,chapter] at (current page.south east)} {\node[anchor=north west,rotate=90,chapter] at (current page.south west)} {\chaptertitle} ; \ifthispageodd { \draw[mygray,very thin] (current page.south east)++(-.6in,0)--++(0,.6\paperheight) ; } { \draw[mygray,very thin] (current page.south west)++(.6in,0)--++(0,.6\paperheight) ; } \end{tikzpicture} } % ------------------------------------------------- % chapter layout:\usepackage{etoolbox} \newbool{schapter} \makeatletter \patchcmd\@chapter {\ifnum \scr@osectarg} {\boolfalse{schapter}\ifnum \scr@osectarg} {}{\error} \patchcmd\@schapter {\if@twocolumn} {\booltrue{schapter}\if@twocolumn} {}{\error} \patchcmd\@chapter {\@topnewpage[\@makechapterhead{#2}]} {\@topnewpage[\@makechapterhead{#2}]\null\newpage\vspace*{1in}} {}{\error} \patchcmd\@schapter {\@topnewpage[\@makeschapterhead{#1}]} {\@topnewpage[\@makeschapterhead{#1}]\null\newpage\vspace*{1in}} {}{\error} \makeatother \newcommand\savechapter[1]{\gdef\chaptertitle{#1}} \newcommand*\chapterbox[1]{% \savechapter{#1}% \begin{tikzpicture}[remember picture, overlay] \fill[mygray] (current page.north west) rectangle (current page.south) ; \draw (current page.north) ++(0,-2in) node[mygray,fill=darkred,inner sep=1em,align=center,minimum width=.75\textwidth] (chapapp) {\ifbool{schapter}{}{\rlap{\Huge\chapapp\space\thechapter:}}} ; \node[anchor=north,mygray,fill=darkred!85,inner sep=1em,xshift=-.6in] at (chapapp.south) {\scalebox{2.5}{\bfseries\MakeUppercase{#1}\hspace*{.2in}}} ; \end{tikzpicture} } \setkomafont{chapter}{\chapterbox} % ------------------------------------------------- % section layout:\setcounter{secnumdepth}{0} \newcommand\sectionrule{% \makebox[0pt][l]{\rule[-.25ex]{\linewidth}{1pt}}} \newcommand\sectionformat[1]{% \sffamily\huge\color{darkred}% \sectionrule \hfill\MakeUppercase{#1}} \setkomafont{section}{\sectionformat} % ------------------------------------------------- \usepackage{lipsum}% dummy text \begin{document} \chapter*{Introduzzione} \lipsum[1-2] \section{Foo Bar Baz} \lipsum[3-11] \chapter{Personaggi} \lipsum[1-2] \section{Foo Bar Baz} \lipsum[3-11] \end{document}
选自:http://tex.stackexchange.com/questions/94430/headers-and-page-numbers-in-external-borders
发表评论 取消回复