0

I have problem for my book.

(1) The text in the left/right side is too long. How to make it into two lines?

(2) I cannot change the opacity into 0.2 only for rose background picture. How to change it?

This is my code.

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

\backgroundsetup{
    scale=1,
    color=black,
    opacity=0.2,
    angle=0,
    contents={%
        \includegraphics[width=15cm,height=15cm,keepaspectratio]{rose.jpg}
    }%
}

\AddToShipoutPictureBG{\checkoddpage\ifoddpage
\AtPageLowerLeft{\hspace*{\dimexpr\paperwidth-2.4cm}
\rotatebox{90}{\makebox[\paperheight]{\textcolor{Red!70}{\small\textbf{This book is used for practicum of the Numerical Ordinary Differential Equation Mathematics Department. Please don't copy, upload, or sell this book.}}}}}%
\else\AtPageUpperLeft{\hspace*{1.8cm} \rotatebox{-90}{\makebox[\paperheight]{\textcolor{SteelBlue!70}{\small\textbf{This book is used for practicum of the Numerical Ordinary Differential Equation Mathematics Department. Please don't copy, upload, or sell this book.}}}}}\fi%
}%

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

\newpage
\section{DEF}
\lipsum

\newpage
\section{GHI}
\lipsum
\end{document} 

enter image description here

How to solve it?

  • Use \parbox{\texteifght}{...} instead of \makebox. – John Kormylo Jul 30 '19 at 12:30
  • 2
    As for opacity, that would depend on what packages you are using. I would have used tikz and everypage instead. – John Kormylo Jul 30 '19 at 12:38
  • In the future please only ask a single question per post – nigel Jul 31 '19 at 11:06
0

(1) My answer to your previous question automatically splits the text into two lines if it get too long.

(2) The picture can be added as a node with [opacity=...]

\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. Make the text too long to split over two lines. Make the text too long to split over two lines.};
            \node[opacity=0.2] at (current page.center) {\includegraphics[width=6cm]{CY1zv}};          
        \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. Make the text too long to split over two lines. Make the text too long to split over two lines.}; 
                  \node[opacity=0.2] at (current page.center) {\includegraphics[width=6cm]{CY1zv}};         
              \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 
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
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
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}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.