Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to have a draft watermark only in a \section?

EDIT:

I have in a document more then one \section, and I need the draftwatermark just in some \section. Unfortunately the section with and without the draftwatermark share the page. For example I want the draftwatermark under the text of just one of these sections A,B,C

\documentclass{article}

\usepackage{kantlipsum} % supply mock text

\begin{document}

\section{A}

\kant[2]

\section{B}

\kant[2-4]

\section{C}

\kant[2]

\end{document}
share|improve this question
    
Welcome to TeX.SX! Would you like to be more precise? Do you want the water on all the pages in the section? –  egreg Oct 10 '12 at 12:44
    
Thanks! I really love this site! Yes I need the water on all the page of a session. Not on all the page of the document. –  thewoz Oct 11 '12 at 14:16

4 Answers 4

One option would be to use the background package; to have the watermark appear on some pages, you can say something like

\documentclass{article}
\usepackage{background}
\usepackage{lipsum}

\begin{document}

\SetBgContents{}
\section{Test Section Without Draftwatermark}
\lipsum[1-12]
\section{Test Section With Draftwatermark}
\SetBgContents{Draft}
\lipsum[1-12]
\section{Test Section Without Draftwatermark}
\SetBgContents{}
\lipsum[1-12]

\end{document}

The background material (which can be almost anything you want (image, text) with control over the attributes (placement, color, scale, opacity, etc.) and, by default, "Draft" written diagonally, in red and in a large size) will appear on all the pages between \SetBgContents{Draft} and the following \SetBgContenst{}.

To have the watermark to appear only on selected pages, you can use the pages=some package option and then use \BgThispage on the page(s) you want the watermark to appear:

\documentclass{article}
\usepackage[pages=some]{background}
\usepackage{lipsum}

\begin{document}

\section{Test Section Without Draftwatermark}
\lipsum[1-12]
\section{Test Section With Draftwatermark}
\BgThispage
\lipsum[1-12]
\section{Test Section Without Draftwatermark}
\lipsum[1-12]

\end{document}

If the most recent version of the package is not available in your system, the line

\usepackage[pages=some]{background}

has to be replaced with

\usepackage[some]{background}

Here's an example that manually places the "Draft" mark only for section two:

\documentclass{article}
\usepackage{background}
\usepackage{lipsum}

\begin{document}

\SetBgContents{}
\section{Test Section Without Draftwatermark}
\lipsum[1-6]
\section{Test Section With Draftwatermark}
\backgroundsetup{contents=Draft,scale=4,position={2,-3.5},opacity=1}
\lipsum[1-6]
\section{Test Section Without Draftwatermark}
\backgroundsetup{contents=Draft,scale=4,position={2,-1.4},opacity=1}
\lipsum[1-3]
\SetBgContents{}
\lipsum[1-2]

\end{document}

enter image description here

share|improve this answer
1  
thanks for the answer, but doesn't work if a session with the background and one whiteout are in the same page. I just able to have or all the pages whit the Draftwatermark or just some. but not just in one section. –  thewoz Oct 11 '12 at 14:18
    
@thewoz well, you can always use \BgThispage or \NoBgThispage to add or suppress the background material for seclected pages, or use \clearpage before and after the section with the mark. –  Gonzalo Medina Oct 11 '12 at 15:45
    
@thewoz please see the last example code in my updated answer; process the document three times to see the mark just for section two. Is it something like this what you need? –  Gonzalo Medina Oct 11 '12 at 16:48

An upload to xwatermark has been made. You would need version 1.5.2c of the package to get this to work.

\documentclass{article}
\usepackage{xwatermark}[2012/10/14]
\usepackage{xcolor}
\usepackage{lipsum}

\newwatermark[allpages]{DRAFT}

\begin{document}
\section{Test section without draftwatermark}
\xwmwatermarkoff
\lipsum[1-6]
\section{Test section with draftwatermark}
\xwmwatermarkon
\lipsum[1-6]
\section{Test section without draftwatermark}
\xwmwatermarkoff
\lipsum[1-20]
\section{Test section with draftwatermark}
\xwmwatermarkon
\lipsum[1-2]
\end{document}
share|improve this answer
    
Yeah I try the xwatermark package.. but I need to put the Draftwatermark only within certain sessions. –  thewoz Oct 11 '12 at 14:21

You can define a switch for draftwatermark:

\documentclass{article}
\usepackage{draftwatermark}
\makeatletter
\let\originalsc@watermark\sc@watermark
\newcommand{\draftwatermarkon}{%
  \let\sc@watermark\originalsc@watermark
}
\newcommand{\draftwatermarkoff}{%
  \let\sc@watermark\@empty
}
\makeatother

\usepackage{kantlipsum} % supply mock text

\begin{document}
\draftwatermarkoff % it's on by default

\section{A}

\kant[2-4]

\newpage
\draftwatermarkon

\section{B}

\kant[2-4]

\newpage
\draftwatermarkoff

\section{C}
\kant[2-4]

\end{document}

I wouldn't switch on and off in the middle of a page.

share|improve this answer
    
I of course, but unfortunately I need to switch on and off in the middle of a page. Because my section share the page and I can put the two section in two distinct pages. Is possible do that? –  thewoz Oct 11 '12 at 15:22
    
@thewoz Yes. Just remove the \newpage commands. However, in the page where the `\draftwatermarkoff appears the watermark won't be present; just move it forward if you need it also in the final page of the draft section. But, since the document is a draft, what's the objection to have the draft section start in a new page? –  egreg Oct 11 '12 at 15:25
    
The problems is that I have a layout like the example that I have now put in my original question. And I can not change. –  thewoz Oct 11 '12 at 15:37
1  
@thewoz The problem is: where do you want the watermark? If the draft section starts on page 2 and ends on page 4, where should the watermark be? If you hope to put it automatically only under the text of the draft section, forget it. –  egreg Oct 11 '12 at 15:39
    
I think that I have to forget it, because that is exactly the problem and what I want. In my example I need the watermark just under the section B that is in two different pages. Or may be just in section A and not in section B that share a page. –  thewoz Oct 11 '12 at 15:48

Have you tried the draftmark package? Draftmark allows putting a watermark on selected pages. While that's not as nice as selecting a \section, it should work in most cases.

share|improve this answer
    
Yes I now.. but unfortunately I need the Draftwatermark in some \section –  thewoz Oct 11 '12 at 14:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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