我正在尝试在 *TeX 中重新创建与下图中相同的效果,该图显示了我之前使用 MS Publisher 创建的文档。
如您所见,页码使用自定义字体呈现,页眉也仅显示倾斜的章节名称(奇数页显示在一侧,偶数页显示在另一侧)。两者都位于页面边框中,而不是通常的位置(通常是页面的外部页眉和页脚)。
如果可能的话,我想使用最少数量的包:到目前为止,我已经引入了 KOMA 脚本fontspec
和xcolor
。如果这些包不能获得所需的结果,我会接受任何可以完成工作的包,但我仍然想使用最少数量的包。在这种情况下,哪些包最好用?不幸的是,我不知道该怎么做……你能举几个例子吗?我猜tikz
会用到,但是否有可能避免使用fancyhdr
(我真的不熟悉)?
此外,我想了解如何将徽标插入到 *TeX 源的顶部外角、外部页面边框、内部页面边框和章节开头。我正在尝试重新创建这些元素,但tikz
同样,我不知道如何将它们包含在页面的相关部分中。
我想添加一个最小的工作示例供您开始使用,但目前我手头没有资料,抱歉。我可能会再次附上它们,感谢您的理解。
答案1
我有一些东西可以帮你入门。不过,它仍有许多未完工的区域……它看起来是这样的:
它使用 – 正如您所怀疑的 – TikZ 来绘制框、用灰色填充页面、绘制线条... 这个想法是将一个带有选项的 tikz 图片放在remember picture, overlay
标题中(使用 KOMA 提供的命令scrpage2
)并使用 TikZ 的current page
节点来定位它们。
为了获取具有灰色背景的章节第一页,并且仅显示两列中的第二列,我将使用etoolbox
修补 的内部结构\chapter
。
开始很标准。我们将使用geometry
用于布局而不是 KOMA,typearea
因为使用它更容易选择确定的边距值:
\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}
下一部分现在使用scrpage2
和tikz
作为页眉和页脚。首先要选择一种页面样式,确保章节页面也使用它,然后清除它。然后我设置了一些 TikZ 样式,当 TikZ 魔法在页眉中发生时使用这些样式。代码使用 KOMA\ifthispageodd
为偶数页和奇数页绘制不同的内容:
% -------------------------------------------------
% header and footer:
\usepackage{scrpage2}
\pagestyle{scrheadings}
\renewcommand*\chapterpagestyle{scrheadings}
\clearscrheadfoot
% the page logo - needs to be improved
\newcommand*\logo{%
\textcolor{darkred}{\scalebox{1.3}{ITALIAN} \scalebox{2}{SRD}} \\
d20\scalebox{2}{MODERN}}
% tikz styles:
\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}
}
接下来是章节布局,首先要修补内部结构。修补包括两个方面:设置布尔值来确定章节是否编号,并\newpage
在适当的位置插入一个,让文本从第二列开始。接下来,我们利用 koma 字体chapter
来保存章节名称\chaptertitle
(上面的代码中已经将其用于页脚),并将章节名称写在深红色框中:
% -------------------------------------------------
% 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}
现在让我们把所有东西放在一起。上图的代码:
\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}