0

I'd like to have a tiled text wallpaper covering the whole page. I have found this old post about the \newwallpaper macro in the xwatermark package, which seems to be able to do what I need.

I cannot seem to understand how to control the size of the font, though. Whatever I do the fontsize option has no effect.

By setting squaretiles=false and specifying xtilesize and ytilesize I can reduce the text size. However the text in the wallpaper seems to be a "stretched image" containing the text rather than an actual text.

Here's a mwe

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper, total={18cm, 26cm}]{geometry}
\usepackage{xcolor}
\usepackage[printwatermark]{xwatermark}
\usepackage{lipsum}
\newwallpaper[%
  page=1,fontfamily=cmr,fontsize=10pt,textcolor=gray!10,
  textalign=center,textangle=0,tilexoffset=10pt,squaretiles=false,tilexsize=4.0cm,tileysize=1.0 cm,
  tileyoffset=10pt,boxalign=center,picontoptext=false,wpxoffset=0cm,
]{some text}

\begin{document} \lipsum[3]

\lipsum[5] \end{document}

And here's the output this is the result with the text "some text"

This is a problem for me, because the text in the wallpaper should have different lengths for different documents. Here's what I get with a longer text this is the result with "a somewhat longer text"

The font size decreases, and it seems to me that it's compressed along the line (different aspect ratio).

It would be better for me to have an actual repeated text with a fixed size rather than a stretched image. I thought this was controlled via the fontsize and fontfamily parameters, but neither of them seem to have any effect. I also tried with normal text, to no avail. I am reading the xwatermark guide, but I have not understood what I'm doing wrong, yet.

PFB
  • 13
  • 2
    don't use xwatermark, it uses the catoptions package and is not compatible with a current latex. Your example error for me with ! Extra \endgroup.\document ->\endgroup. – Ulrike Fischer Mar 19 '21 at 18:19
  • Hi. I have no compatibility issues and get no error, both in my local version of LaTeX and in Overleaf. What would be a good alternative to xwatermark? – PFB Mar 19 '21 at 22:28
  • I use either eso-pic or with a new latex (2020-10 or newer) the shipout hooks, https://tex.stackexchange.com/a/496140/2388 – Ulrike Fischer Mar 19 '21 at 22:32
  • Hi, thanks for your time. I still do not understand your answer, though. I'd like to have a "wallpaper watermark" consisting of a repeated text, which is different for every (automatically generated) document. Maybe it's better that I include an example in my OP. It seems to me that eso-pic can be used to put pictures in the background/foreground of the document. – PFB Mar 20 '21 at 14:18
  • eso-pic can also put text in the background/foreground. eso-pic, xwatermark and all the other watermark packages do more or less the same, only with different user interfaces. – Ulrike Fischer Mar 20 '21 at 14:29

0 Answers0