简体   繁体   English

LaTeX中如何为每个页面设置不同的背景

[英]How to set different backgrounds for each page in LaTeX

I am trying to set different backgrounds in each page of my LaTeX document.我正在尝试在 LaTeX 文档的每一页中设置不同的背景。 I have tried with tikz, background and many other packages I found, but I couldn't.我尝试过使用 tikz、background 和我找到的许多其他软件包,但我做不到。

IE IE

First page: \maketitle with one background第一页: \maketitle有一个背景

Second page: \tableofcontents with a different background第二页:具有不同背景的\tableofcontents

Third pages and following: Content with another background第三页及以下:具有其他背景的内容

[Edit 1] [编辑 1]

There is something I didn't explain well.有一点我没有解释清楚。 Your code helped me a lot, but I tried to modify it and had some problems.您的代码对我帮助很大,但我尝试修改它并遇到了一些问题。

    \documentclass[a4paper, 12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{eso-pic}
\usepackage[spanish]{babel}
\usepackage[absolute,overlay]{textpos}
\usepackage{xcolor} \definecolor{letras_portada}{RGB}{229,238,245}




\begin{document}

\AddToShipoutPictureBG*{\includegraphics[width=\paperwidth,height=\paperheight]{First_page.png}}
\begin{textblock*}{15cm}(6.35cm,23cm) 
    \huge{\textcolor{letras_portada}{\textbf{Report}}}
\end{textblock*}

\cleardoublepage

\AddToShipoutPictureBG*{\includegraphics[width=\paperwidth,height=\paperheight]{Index.png}}
\paragraph{}
\clearpage

\AddToShipoutPictureBG{\includegraphics[width=\paperwidth,height=\paperheight]{Content.png}}
\tableofcontents
\clearpage

\section{section 1}
text example 1text example 1text example 1text example 1text example 1text example 1text example 1text example 1text example 1text example
\subsection{2}
text example 1text example 1text example 1text example 1text example 1text example 1
\subsubsection{3}
text example 1text example 1text example 1text example 1text example 1text example 1



\end{document}

What I pretend as is to have a first page with my title (instead of maketitle I a text), a second page with an specific background but without text and in the third page I'd like to have the table of contents.我假装的第一页有我的标题(而不是 maketitle 我是文本),第二页有特定背景但没有文本,第三页我想有目录。 But second page disappear.但是第二页消失了。

One possibility is the eso-pic package.一种可能性是eso-pic package。 With \AddToShipoutPictureBG*{} you can change the background of the current page, with \AddToShipoutPictureBG{} of the current and all following pages.使用\AddToShipoutPictureBG*{}您可以更改当前页面的背景,使用\AddToShipoutPictureBG{}更改当前页面和所有后续页面的背景。

\documentclass{book}

\usepackage{graphicx}
\usepackage{eso-pic}

\author{names}
\title{title}

\begin{document}

\AddToShipoutPictureBG*{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-duck}}
\maketitle

\cleardoublepage
\AddToShipoutPictureBG*{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}}
\tableofcontents

\clearpage
\AddToShipoutPictureBG{\includegraphics[width=\paperwidth,height=\paperheight]{example-grid-100x100bp}}

\chapter{title}
text

\end{document}

To add background only pages in a one sides documentclass, you could use this quick hack:要在单面文档类中添加仅背景页面,您可以使用以下快速技巧:

 \documentclass[a4paper, 12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{eso-pic}
\usepackage[spanish]{babel}
\usepackage[absolute,overlay]{textpos}
\usepackage{xcolor} \definecolor{letras_portada}{RGB}{229,238,245}




\begin{document}

\AddToShipoutPictureBG*{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}}
\begin{textblock*}{15cm}(6.35cm,23cm) 
    \huge{\textcolor{letras_portada}{\textbf{Report}}}
\end{textblock*}
\mbox{}

\newpage

\mbox{}
\AddToShipoutPictureBG*{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-b}}


\newpage

\AddToShipoutPictureBG{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-c}}
\tableofcontents
\clearpage

\section{section 1}
text example 1text example 1text example 1text example 1text example 1text example 1text example 1text example 1text example 1text example
\subsection{2}
text example 1text example 1text example 1text example 1text example 1text example 1
\subsubsection{3}
text example 1text example 1text example 1text example 1text example 1text example 1

\newpage
\ClearShipoutPictureBG
\AddToShipoutPictureBG{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-b}}
\mbox{}


\end{document}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM