在书的每一页上添加文本框

在书的每一页上添加文本框

我想将文本框放在每个奇数页的右侧,以及每个偶数页的左侧。我不知道该怎么做。这是我的代码。

\documentclass[a4paper,twoside,12pt]{book}
\usepackage[left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{xcolor}
\usepackage{tikz}


\begin{document}
    \chapter{ONE}
    \noindent\fbox{%
        \parbox{\textwidth}{%
            \rotatebox{270}{\textcolor{blue}{\textbf{Please don't copy and sell this book.}}}
        }%
    }
    \section{ABC}
Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test 

\newpage
\section{DEF}
Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test 
\end{document}

此代码给我 在此处输入图片描述

我想要如下结果

在此处输入图片描述

在此处输入图片描述

怎么做?

现在我想在每页的中心添加玫瑰图片,不透明度为 0.2。我无法为图片设置不同的不透明度。该怎么做? 在此处输入图片描述

答案1

tikz 和 background 包的联合作用导致了这样的结果:

\documentclass[a4paper,twoside,12pt]{book}
\usepackage[left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{xcolor}
\usepackage{tikz}

\usepackage{background}
\usepackage{tikzpagenodes}
\usepackage{ifthen}

\backgroundsetup%
{   angle=0,
    opacity=1,
    scale=1,
    contents=%
    {
    \ifthenelse{\isodd{\thepage}}{%
       \begin{tikzpicture}[remember picture,overlay]
            \node[draw=black,text=blue,rotate=-90, above=1cm, text width=\textheight, align=center,font=\bfseries, inner sep=0.3cm] at (current page text area.east) {Please don't copy and sell this book.};          
        \end{tikzpicture}
      }{
             \begin{tikzpicture}[remember picture,overlay]
                  \node[draw=black,text=blue,rotate=90, above=1cm, text width=\textheight,align=center,font=\bfseries, inner sep=0.3cm] at (current page text area.west) {Please don't copy and sell this book.};       
              \end{tikzpicture}
       }
    }
}

\begin{document}
    \chapter{ONE}
    \section{ABC}
Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test 

\newpage
\section{DEF}
Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test 
\end{document}

在此处输入图片描述

答案2

使用 和 非常简单eso-picifoddpage请注意,我没有保留框架,但添加它们很容易。

\documentclass[a4paper,twoside,12pt]{book}
\usepackage[margin=3cm]{geometry}
\usepackage{graphicx, rotating}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usepackage{eso-pic, ifoddpage}
\usepackage{lipsum}

\AddToShipoutPictureBG{\checkoddpage\ifoddpage
\AtPageLowerLeft{\hspace*{\dimexpr\paperwidth-2.4cm}
\rotatebox{90}{\makebox[\paperheight]{\textcolor{SteelBlue!70}{\small\textbf{Please don't copy and sell this book.}}}}}%
\else\AtPageUpperLeft{\hspace*{1.8cm} \rotatebox{-90}{\makebox[\paperheight]{\textcolor{SteelBlue!70}{\small\textbf{Please don't copy and sell this book.}}}}}\fi%
}%

\begin{document}
    \chapter{ONE}

    \section{ABC}
Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test

\newpage
\section{DEF}
Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test
\lipsum

\end{document} 

在此处输入图片描述

相关内容