1

I am using the draftwatermark package and with a document that contains verbatim sections. This is an usual/unwanted outcome where the current page (or next page) formatting is effecting the font of the DRAFT mark made on the pages.

How can I control the font?

Minimum working example:

\documentclass{article}

\usepackage{draftwatermark} \usepackage{lipsum}

\begin{document} \lipsum[1-10] \begin{verbatim} { "aaaaaaaa": { "aaaa": "aaaaaa", "aaaa": "aaaaaaa", "aa": 000, "aaaaaa_aa": 0, "aaaaaaaa_aaaaaa": [ { "aaaa": "aaaaaa", "aaaaaaa_aa": "aaaaaaa_aaaaaaa" } ] } }, { "aaaaaaaa": { "aaaa": "aaaaaaaa", "aaaa": "aaaaa", "aa": 00000000, "aaaaaa_aa": 000, "aaaaaaaa_aaaaaa": [ { "aaaa": "aaaaaaaa", "aaaaaaa_aa": "aaaaa_aa_aaaa" } ] } }, { "aaaaaaaa": { "aaaa": "aaaaaaa", "aaaa": "aaaa", "aa": 00000000, "aaaaaa_aa": 00000000, "aaaaaaaa_aaaaaa": [ { "aaaa": "aaaaaaa", "aaaaaaa_aa": "aaaa_aa_aaaa" } ] } }, { "aaaaaaaa": { "aaaa": "aaaaaa", "aaaa": "aaaaaaa", "aa": 000, "aaaaaa_aa": 0, "aaaaaaaa_aaaaaa": [ { "aaaa": "aaaaaa", "aaaaaaa_aa": "aaaaaaa_aaaaaaa" } ] } }, { "aaaaaaaa": { "aaaa": "aaaaaa", "aaaa": "aaaa", "aa": 00000000, "aaaaaa_aa": 000, "aaaaaaaa_aaaaaa": [ { "aaaa": "aaaaaa", "aaaaaaa_aa": "aaaa_aa_aaaa" } ] } } \end{verbatim} \end{document}

psitae
  • 137

1 Answers1

1

You have a couple of options here. By far the easiest is to "reset" the text to include \normalfont:

\SetWatermarkText{{\normalfont DRAFT}}

Alternatively, you can remove what draftwatermark inserts in the shipout routine's background layer (shipout/background) and reinsert something that includes \normalfont:

\makeatletter
\RemoveFromHook{shipout/background}[draftwatermark]% Remove default watermark
\AddToHook{shipout/background}[draftwatermark]{%
  {\normalfont\draftwatermark@print{\draftwatermark@markcmd}}%
}
\makeatother

The former approach is shown here with a minimal example:

\documentclass{article}

\usepackage{draftwatermark} \usepackage{lipsum}

\SetWatermarkText{{\normalfont DRAFT}}% Avoid font changes across page boundaries that has font changes

\begin{document}

\lipsum[1-10]

\ttfamily% Switch to a different font family \lipsum[1-5]

\end{document}

Werner
  • 603,163