我正在尝试在页面(实际上是标题页)中定义一个框,该框应该在页面背景(即图片.jpg
)上显示为“透明”。
我使用的代码如下:
\documentclass[dvipsnames,a5paper,twoside,openright,italian,12pt]{memoir}
\usepackage{defines}
\author{The author}
\date{2016}
\title{The title}
\editor{The editor}
\begin{document}
\frontmatter
\mytitle
\tableofcontents
\include{Preface}
\mainmatter
\include{Chapter01}
\include{Chapter02}
\end{document}
在“defines.sty”中我定义了结构和命令:
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage{verse}
\usepackage{background}
\usepackage[object=vectorian]{pgfornament}
\usepackage{svg}
\usepackage{wallpaper}
\usepackage[osf]{libertine}
\usetikzlibrary{calc}
\backgroundsetup{
contents={
\if@mainmatter
\eachpageornament \thepage
\else
\ifnum\value {page}=1
\else
\eachpageornament \thepage
\fi
\fi
},
position=current page.north east,
angle=0,%
scale=1,%
opacity=0.5%
}
\newcommand{\editor}[1]{\def\@editor{#1}}
\newcommand{\theeditor}{%
\@editor
}
\newcommand{\eachpageornament}{
\begin{tikzpicture}[remember picture, overlay, color=LimeGreen]
\node[anchor=north west](CNW) at (current page.north west){
\pgfornament[width=2cm]{61}};
\node[anchor=north east](CNE) at (current page.north east){
\pgfornament[width=2cm,symmetry=v]{61}};
\node[anchor=south west](CSW) at (current page.south west){
\pgfornament[width=2cm,symmetry=h]{61}};
\node[anchor=south east](CSE) at (current page.south east){
\pgfornament[width=2cm,symmetry=c]{61}};
\pgfornamenthline{CNW}{CNE}{north}{87}
\pgfornamenthline{CSW}{CSE}{south}{87}
\pgfornamentvline{CNW}{CSW}{west}{87}
\pgfornamentvline{CNE}{CSE}{east}{87}
\end{tikzpicture}
}
\newcommand{\plogo}{\includegraphics[width = 30mm]{logo.png}}
\newcommand{\psignature}{
\begin{flushright}
\def\svgwidth{40mm}
\input{signature.pdf_tex}
\end{flushright}
}
\newcommand{\mytitle}{
\thispagestyle{empty}
\ThisCenterWallPaper{1.12}{sfondo}
\begin{tikzpicture}[remember picture, overlay]
\node [rectangle, rounded corners, fill=LimeGreen, opacity=0.75, anchor=south west, minimum width=6cm, minimum height=8cm] (box) at (-0.5,-10) (box){};
\node[anchor=west, xshift=-2.0cm, yshift=-1cm, text width=4cm] at (box.north){\large \textit{\theeditor}};
\node[anchor=west, xshift=-2.0cm, yshift=-3.5cm, text width=4cm] at (box.north){\huge \thetitle};
\node[anchor=west, xshift=-2.0cm, yshift=-6cm, text width=4cm] at (box.north){\large \theauthor};
\end{tikzpicture}
\newpage
}
\pagestyle{plain}
\setcounter{tocdepth}{2}
\renewcommand{\poemtoc}{section}%
\renewcommand{\poemtitlefont}{\normalfont\large\itshape\centering}
该节点实例应定义一个不透明度为 75% 的绿色圆角框:
\node [rectangle, rounded corners, fill=LimeGreen, opacity=0.75, anchor=south west, minimum width=6cm, minimum height=8cm] (box) at (-0.5,-10) (box){};
但只要我能看到盒子里充满了纯绿色......
我采纳建议的原始模板可以在以下链接中找到: 图书样本
当然它可以工作...但据我所知,它与我的没有什么不同,不会改变盒子的行为。
答案1
该包transparent
自动加载的包svg
与 TikZopacity
密钥冲突。
您可以:
- 卸载
svg
软件包,以便 TikZ 不透明度能够按预期工作 - 通过在加载之前发出¹来卸载
transparent
包,这是冲突的真正根源(这可能会导致包行为异常)\expandafter\def\csname [email protected]\endcsname{}
svg
svg
使用
\transparent
宏代替 Tikz 不透明度键,如下所示:{\transparent{0.5}\node [rectangle, rounded corners, fill=LimeGreen, anchor=south west, minimum width=6cm, minimum height=8cm] (box) at (-0.5,-10) (box){};}
外部的分组\transparent
阻止将宏应用于整个 tikzpicture
另请参阅svg 包干扰不透明度