# background package - Using text with line breaks

I'm designing a very simple cover for a university publication in Sanskrit. I'm using the package "background" to add some "watermark-like" Sanskrit text on the cover, both top and bottom, while the title etc will go in the middle of the page.

All works well, except that I want two lines of "watermark" text on the top, and three lines of text on the bottom of the page. The top works fine (clarification: right now I have three lines on top, just to see if it works). But I can't get the bottom text to give multiple lines, just one line. I've tried \par instead of \\ but that also doesn't work.

I'll give the code for the whole, so someone can replicate it if they like (you don't need to know Sanskrit!). And JFYI, I reduced the space between the upper text and the lower, so that there would be room for multiple lines, but that does nothing. Anyone have any idea how to get the desired effect? Thanks in advance. (Oh, and this is my first time posting a question here, so feedback on anything done wrong or left out is welcome.)

\documentclass[12pt,sanskrit]{memoir}
\usepackage[b6paper]{geometry}
\usepackage{graphicx}
\usepackage[pages=some]{background}
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont[Script=Devanagari]{Siddhanta}
\usepackage{polyglossia}
\setdefaultlanguage{sanskrit}

\SetBgScale{1}
\SetBgContents{\parbox{12cm}{ %
\normalsize अथातो ब्रह्मजिज्ञासा । जन्माद्यस्य यतः । शास्त्रयोनित्वात् । तत्तुसमन्वयात् ।\\
अथ योगानुशासनम् । योगश्चित्तवृत्तिनिरोधः । तदा द्रष्टुःस्वरूपेऽवस्थानम् ।\\
चैतन्यमात्मा । ज्ञानं बन्धः । योनिवर्गः कलाशरीरम् । ज्ञानाधिष्ठानं मातृका । \\
[15cm]\rotatebox{0}{ %
\normalsize अथातो भक्तिं व्याख्यास्यामः । सा त्वस्मिन् परमप्रेमरूपा अमृतस्वरूपा च ।
अथातो भक्तिजिज्ञासा । सा पराऽनुरक्तिरीश्वरे । तत्संस्थस्यामृतत्वोपदेशात् । ज्ञानमिति चेन्न द्विष \\
चैतन्यमात्मा । ज्ञानं बन्धः । योनिवर्गः कलाशरीरम् । ज्ञानाधिष्ठानं मातृका । उद्यमो भैरवः । \\}}}
\SetBgColor{gray}
\SetBgAngle{0}
\SetBgOpacity{0.6}

\begin{document}
\title {ॐ\\मोक्षसाधनसूत्रसंग्रहः\\
\normalsize {नारदभक्तिसूत्र-\\
शाण्डिल्यभक्तिसूत्र-\\
पातञ्जलयोगसूत्र-\\
वसुगुप्तकृतशिवसूत्र-\\
बादरायणकृतब्रह्मसूत्र-\\
समेतः, मूलमात्रः ॥\\}}
\date{}
\maketitle
\BgThispage
\thispagestyle{empty}
\noindent\begin{center}
विवेकानन्दविश्वमहाविद्यालयम्
\par\end{center}
\newpage
नमस्ते सर्वभुतेभ्यो ।
\end{document}


Here I'll add a "before" and "after" image -- when the bottom text would only accept one line, and after Steven's fix with stackengine.

Only one line:

And after the fix:

I could not get things to compile, so I converted to Latin text and compiled with pdflatex. But, since your background lines did not require autowrapping, I suggest the use of the stackengine package:

\documentclass[12pt,sanskrit]{memoir}
\usepackage[b6paper]{geometry}
\usepackage{graphicx}
\usepackage[pages=some]{background}
%\usepackage{xunicode}
%\usepackage{xltxtra}
%\setmainfont[Script=Devanagari]{Siddhanta}
%\usepackage{polyglossia}
%\setdefaultlanguage{sanskrit}
\usepackage{stackengine}
\setstackEOL{\\}
\setstackgap{L}{\normalbaselineskip}
\def\stacktype{L}
\def\stackalignment{c}
\SetBgScale{1}
\SetBgContents{\normalsize\stackunder[15cm]{\Longstack{%
111 111 111\\
222 222 222\\
333 333 333}}{%
\rotatebox{0}{\Longstack{%
4444 444 444 4444 444 444 \\
555 5555 555 555}}}}
\SetBgColor{gray}
\SetBgAngle{0}
\SetBgOpacity{0.6}

\begin{document}
\title {A\\BBBBB\\
\normalsize {CCCCCC\\
DDDDD\\
EEEEE\\
FFFFF\\
GGGGG\\
HHHHHH\\}}
\date{}
\maketitle
\BgThispage
\thispagestyle{empty}
\noindent\begin{center}
IIIIIIIIIIIII
\par\end{center}
\newpage
JJJJJJJJJJJJ
\end{document}


The Background text is horizontally centered, whereas the normal text seems to have a slight leftward offset associated with the style. If the background needs to be horizontally adjusted, then one can add a kern at the end:

\SetBgContents{\normalsize\stackunder[15cm]{\Longstack{%
111 111 111\\
222 222 222\\
333 333 333}}{%
\rotatebox{0}{\Longstack{%
4444 444 444 4444 444 444 \\
555 5555 555 555}}}\kern30pt}

• That works, Steven. Didn't know stackengine; glad to learn about it. Will look for documentation online. And I hadn't even noticed the offset till you mentioned it. The \kern30pt didn't seem to fix it, but I'll play with it till I get it. I'm going to post the result now. – chasashmore Apr 29 '16 at 4:02
• @chasashmore Thanks! Here is the official link: ctan.org/pkg/stackengine – Steven B. Segletes Apr 29 '16 at 10:35

When I asked my original question, I was new to the package background and to \parbox. In fact, I was (am) fairly new to LaTeX, having used LyX in the past. With a little more experience, I found a very simple solution to the original problem: how to get more than one line of "watermark-like" text at the bottom of the page. And that is simply to use \parbox twice, once for the upper text, and once for the lower text. Then there is no need for the otherwise very useful package stackengine. The code just for the call to background is as follows:

    \SetBgScale{1}
\SetBgContents{\parbox{12cm}{ %
{\fontspec[Script=Devanagari]{Siddhanta-Calcutta}
\large अथातो ब्रह्मजिज्ञासा । जन्माद्यस्य यतः । शास्त्रयोनित्वात् । तत्तु\\
अथ योगानुशासनम् । योगश्चित्तवृत्तिनिरोधः । तदा द्रष्टुः स्वरूपेऽ\\
[13cm]\rotatebox{0}{ %
\parbox{12cm}{\large अथातो भक्तिं व्याख्यास्यामः । सा त्वस्मिन् परमप्रेमरूपा । अमृ \\
अथातो भक्तिजिज्ञासा । सा पराऽनुरक्तिरीश्वरे । तत्संस्थस्यामृत\\
चैतन्यमात्मा । ज्ञानं बन्धः । योनिवर्गः कलाशरीरम् । ज्ञानाधिष्ठा}}}}}
\SetBgColor{gray}
\SetBgAngle{0}
\SetBgOpacity{0.5}


• Of course, the \rotatebox{0} is not necessary. I just keep it the code in so that I remember how to rotate it for other purposes. – chasashmore May 18 '16 at 5:16