我的标题页的背景设置

我的标题页的背景设置

我在使用 tikz 设置标题页背景时遇到了麻烦。我采用了 Benmiloud Mohammed 的这种背景样式https://latexdraw.com/\titleTMB我还采用了第 25、59-60 页的标题页内容标题页的一些示例作者:Peter Wilsonhttps://mirror.ufs.ac.za/ctan/info/latex-samples/TitlePages/titlepages.pdf。现在,使用该background包,我无法为我的标题页创建背景,如下图所示(来源:https://raw.githubusercontent.com/tikz-examples/LatexGraphics/master/CoverPageStar.tex):
所需背景
以下是我的 MWE:

% !TeX TS-program = xelatex

\documentclass[12pt,openany,twoside]{book}
\raggedbottom

\usepackage{background}

\usepackage{fancyhdr}
 
\usepackage{fontspec}% this package is important in my project

\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{ shapes.geometric }
\usetikzlibrary{calc}

\usepackage[T1]{fontenc}

\newlength{\drop}
\begin{document} 

    \begin{titlepage}
        
        \backgroundsetup{
            scale=1,
            angle=0,
            opacity=1,
            contents={\begin{tikzpicture}[remember picture,overlay]
                    %%%%%%%%%%%%%%%%%%%% Background %%%%%%%%%%%%%%%%%%%%%%%%
                    \fill[Dandelion] (current page.south west) rectangle (current page.north east);
                    
                    
                    \foreach \i in {100,95,...,5}{
                        \node[fill=Dandelion!\i,draw=none,star, minimum size=\i cm,thick] at (current page.east){}; }
            \end{tikzpicture}}
        }
        
        \drop=0.1\textheight
        \centering
        \vspace*{\baselineskip}
        \rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt}
        \rule{\textwidth}{0.4pt}\\[\baselineskip]
        {\LARGE CONUNDRUMS\\ AND \\[0.3\baselineskip] PUZZLES}\\[0.2\baselineskip]
        \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt}
        \rule{\textwidth}{1.6pt}\\[\baselineskip]
        \scshape
        Selected and Expanded Papers from the Organisation Working Conference on \\
        Enigmas \\
        Location, date from--to\par
        \vspace*{2\baselineskip}
        Edited by \\[\baselineskip]
        {\Large FIRST EDITOR \\ SECOND EDITOR \\ THIRD EDITOR\par}
        {\itshape Organisation \\ Address\par}
        \vfill
        {\scshape year} \\
        {\large THE PUBLISHER}\par
        
    \end{titlepage}
    
    \backgroundsetup{contents={}}
    
    \chapter{Results}
    \section{Equations and Matrices}
    \subsection{Equations}
    AMS package is loaded to typeset Higher Mathematics equations. A single equation can be on one line, several lines (no alignment) and several lines (with alignment). Also equation groups can be without alignment, with simple alignment and or multiple alignment. Equations can also be in cases.
\end{document}

答案1

由于背景内容代码中有空行,因此会出现错误。

我不会为此使用背景包,它在内部也使用 tikz 图片,而嵌套 tikz 图片很困难。此外,使用current page节点总是需要两次编译。您可以使用 shipout/background 钩子执行相同操作。

不要将 T1 编码与 lualatex/xelatex 一起使用。对于 unicode 引擎来说,这是错误的字体编码。

\documentclass[12pt,openany,twoside]{book}
\raggedbottom

\usepackage{fancyhdr}

\usepackage{fontspec}% this package is important in my project

\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{ shapes.geometric }
\usetikzlibrary{calc}


\newlength{\drop}
\begin{document}
\AddToHookNext{shipout/background}
{\put(0,-\paperheight)
  {%
   \begin{tikzpicture}   
   \fill[use as bounding box,Dandelion] (0,0) rectangle (\paperwidth,\paperheight);
   \foreach \i in {100,95,...,5}{
     \node[fill=Dandelion!\i,draw=none,star, minimum size=\i cm,thick] at (0.5\paperwidth,0){}; }
   \end{tikzpicture}
  }
}

    \begin{titlepage}

        \drop=0.1\textheight
        \centering
        \vspace*{\baselineskip}
        \rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt}
        \rule{\textwidth}{0.4pt}\\[\baselineskip]
        {\LARGE CONUNDRUMS\\ AND \\[0.3\baselineskip] PUZZLES}\\[0.2\baselineskip]
        \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt}
        \rule{\textwidth}{1.6pt}\\[\baselineskip]
        \scshape
        Selected and Expanded Papers from the Organisation Working Conference on \\
        Enigmas \\
        Location, date from--to\par
        \vspace*{2\baselineskip}
        Edited by \\[\baselineskip]
        {\Large FIRST EDITOR \\ SECOND EDITOR \\ THIRD EDITOR\par}
        {\itshape Organisation \\ Address\par}
        \vfill
        {\scshape year} \\
        {\large THE PUBLISHER}\par

    \end{titlepage}

 

    \chapter{Results}
    \section{Equations and Matrices}
    \subsection{Equations}
    AMS package is loaded to typeset Higher Mathematics equations. A single equation can be on one line, several lines (no alignment) and several lines (with alignment). Also equation groups can be without alignment, with simple alignment and or multiple alignment. Equations can also be in cases.
\end{document}

在此处输入图片描述

相关内容