2

Consider this MWE:

\documentclass[table]{standalone}
\usepackage{graphicx, polyglossia, lipsum}
\usepackage[most]{tcolorbox}

\newtcolorbox{mybox}[2][]{%
  enhanced,
  before upper=\setlength{\parskip}{\bigskipamount},
  colframe=black,
  boxrule=2mm,
  bottomrule=8mm,
  colbacktitle=black,
  fonttitle=\bfseries\centering,
  overlay app={%
    \node[white, anchor=south, text width=.95\textwidth] at (frame.south) {Some footer text};},
  title=#2,#1}

\newcommand{\xxbody}{
  \lipsum[2]

  \noindent\includegraphics[width=\textwidth]{example-image-golden}

  \lipsum[3]
}

\newcommand{\xxheading}{%
  Heading
}

\begin{document}

\begin{mybox}{\LARGE \xxheading{}}

  \xxbody{}

\end{mybox}

\end{document}

I want to put some watermark text, say, 'Draft'. The text should run from the bottom left to top right corner of the text box and on lines parallel to that line. So, 'Draft' will appear multiple times. The angle of the text will change as the text box grows smaller or bigger.

It should be above the entire content, including the image.

Can this be done? How?

1 Answer 1

4

Like this?

enter image description here

\documentclass[table]{standalone}
\usepackage{graphicx, polyglossia, lipsum}
\usepackage[most]{tcolorbox}
\usetikzlibrary{patterns, calc}

\tcbset{ribbon/.style={finish={%
\begin{tcbclipframe}
\path (frame.south west) -- (frame.north east) let \p1=($(frame.north east)-(frame.south west)$) in node[red, midway, sloped, font=\Huge\bfseries, align=center, text width={veclen(\x1,\y1)}] {Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft};
    \end{tcbclipframe}}}}

\newtcolorbox{mybox}[2][]{%
  enhanced,
  before upper=\setlength{\parskip}{\bigskipamount},
  colframe=black,
  boxrule=2mm,
  bottomrule=8mm,
  colbacktitle=black,
  fonttitle=\bfseries\centering,
  overlay app={%
    \node[white, anchor=south, text width=.95\textwidth] at (frame.south) {Some footer text};}
    overlay={
    \path (frame.south west)--(frame.north east) node[red, draw, midway, sloped, font=\Large] {Draft\\ Draft\\ Draft};},
  title=#2,#1}

\newcommand{\xxbody}{
  \lipsum[2]

  \noindent\includegraphics[width=\textwidth]{example-image-golden}

  \lipsum[3]
}

\newcommand{\xxheading}{%
  Heading
}

\begin{document}

\begin{mybox}[ribbon]{\LARGE \xxheading{}}

  \xxbody{}

\end{mybox}

\end{document}

Update:

To just cover text part, tcbclipinterior can be used. To cover the whole contents, a longer text is needed or a longer text and larger scale.

If you want to be sure that everything is covered, instead of a unique node, several independent lines can be drawn.

\documentclass[table]{standalone}
\usepackage{graphicx, polyglossia, lipsum}
\usepackage[most]{tcolorbox}
\usetikzlibrary{patterns, calc}

\tcbset{ribbon/.style={finish={%
\begin{tcbclipinterior}
\path (frame.south west) -- (frame.north east) let \p1=($(frame.north east)-(frame.south west)$) in node[red, midway, sloped, font=\Huge\bfseries, align=center, text width={veclen(\x1,\y1)}, scale=2, opacity=.5] {Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft Draft};
    \end{tcbclipinterior}}}}

\newtcolorbox{mybox}[2][]{%
  enhanced,
  before upper=\setlength{\parskip}{\bigskipamount},
  colframe=black,
  boxrule=2mm,
  bottomrule=8mm,
  colbacktitle=black,
  fonttitle=\bfseries\centering,
  overlay app={%
    \node[white, anchor=south, text width=.95\textwidth] at (frame.south) {Some footer text};}
    overlay={
    \path (frame.south west)--(frame.north east) node[red, draw, midway, sloped, font=\Large] {Draft\\ Draft\\ Draft};},
  title=#2,#1}

\newcommand{\xxbody}{
  \lipsum[2]

  \noindent\includegraphics[width=\textwidth]{example-image-golden}

  \lipsum[3]
}

\newcommand{\xxheading}{%
  Heading
}

\begin{document}

\begin{mybox}[ribbon]{\LARGE \xxheading{}}

  \xxbody{}

\end{mybox}

\end{document}

enter image description here

3
  • Thanks. This is almost there. Except that the watermark should cover the entire text area. So, there would be more parallel lines containing 'Draft'. And it should not cover the border, only the text area.
    – deshmukh
    Nov 23, 2021 at 16:47
  • @deshmukh Take a look at updated answer
    – Ignasi
    Nov 23, 2021 at 17:09
  • Perfect. Thanks. :)
    – deshmukh
    Nov 24, 2021 at 10:28

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.