Discussion:
[XeTeX] Package background usage in XeLaTeX
RD Holkar
2018-02-13 07:51:17 UTC
Permalink
Dear all,

I am typesetting a memoir in Marathi using package Polyglossia. I found
that the package Background behaves strangely when used with XeLaTeX.

I am attaching an example in English which is clearly a (La)TeX file (I can
send the file that uses Polyglossia if needed). I want two vertical lines
on the left and right side of the page (attachment- Background-LaTeX). When
I use the package background and run LaTeX, I get the desired output.
However, when I run XeLaTeX on the same file, I get a displaced lines.
Moreover, I tried to place the lines by trial and error method, but, it
seems that the distortion is not linear.

Could some please explain how to use this package to get what I want, or
some other way to achieve my goal?

Thank you in advance.

With best regards,
-Rohit.
Zdenek Wagner
2018-02-13 09:33:33 UTC
Permalink
Hi,

it seems to be a problem in TikZ. Anyway, if you just want vertical lines,
you need no package at all. you can do it just by \vrule in your footer:

\makeatletter % allow @ in the macro names
\def\***@mystyle{% definition of the page style
\def\@oddhead{\normalfont \normalsize \hfill \thepage}%
\def\@evenhead{\normalfont \normalsize \thepage \hfill}%
\def\@oddfoot{\vbox to 0pt{% zero height vertical box
\hskip -20mm % negative, to make it wider that the text width
\color{red}\VR \hskip 2pt \VR \hfill \VR \hskip 2pt \VR \hskip -20mm}%
\let\@evenfoot\@oddfoot}
\makeatother % @ no longer allowed

% Define the vertical rule (in order to have the dimensions at one place)
\def\VR{\vrule width 2pt height 200mm depth 0mm}

% Set the page style
\pagestyle{mystyle}

If you need more complex graphics, you can use PDF primitives. You can see
this article:
http://bulletin.cstug.cz/doi.php/10.5300/2013-1/13
It is written in Czech but you can see what can be done.

I have not tried my solution, I just typed it but I hope I have not made a
mistake. You should only modify the dimensions.


Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz
Post by RD Holkar
Dear all,
I am typesetting a memoir in Marathi using package Polyglossia. I found
that the package Background behaves strangely when used with XeLaTeX.
I am attaching an example in English which is clearly a (La)TeX file (I
can send the file that uses Polyglossia if needed). I want two vertical
lines on the left and right side of the page (attachment-
Background-LaTeX). When I use the package background and run LaTeX, I get
the desired output. However, when I run XeLaTeX on the same file, I get a
displaced lines.
Moreover, I tried to place the lines by trial and error method, but, it
seems that the distortion is not linear.
Could some please explain how to use this package to get what I want, or
some other way to achieve my goal?
Thank you in advance.
With best regards,
-Rohit.
--------------------------------------------------
http://tug.org/mailman/listinfo/xetex
Ulrike Fischer
2018-02-16 12:20:54 UTC
Permalink
Post by RD Holkar
Dear all,
I am typesetting a memoir in Marathi using package Polyglossia. I found
that the package Background behaves strangely when used with XeLaTeX.
I am attaching an example in English which is clearly a (La)TeX file (I can
send the file that uses Polyglossia if needed). I want two vertical lines
on the left and right side of the page (attachment- Background-LaTeX). When
I use the package background and run LaTeX, I get the desired output.
However, when I run XeLaTeX on the same file, I get a displaced lines.
Moreover, I tried to place the lines by trial and error method, but, it
seems that the distortion is not linear.
\SetBgContents{
\begin{tikzpicture}[overlay,remember picture]
the background packages already uses tikzpicture and puts the
contents in a node. So you are basically nesting one tikzpicture in
another.

This can work, but it can also fail. See e.g.
https://tex.stackexchange.com/questions/46598/problem-with-overlay-when-a-tikzpicture-is-inside-another-tikzpicture
https://tex.stackexchange.com/questions/398734/whats-wrong-with-nested-tikzpicture-and-xelatex

and more.

So I wouldn't use the background package for this. Use e.g. eso-pic
to insert the drawing.
--
Ulrike Fischer
http://www.troubleshooting-tex.de/



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
RD Holkar
2018-02-17 05:20:05 UTC
Permalink
Hi,

@Urlike Fischer and Zdenek- yes, you are right. I removed the extra tikz
package and I could get the vertical rules; see the attachment. There are
still a similar issue with another document; I shall write once I get
details of it.
@Zdenek Wagner <https://plus.google.com/u/1/106075650385658344372?prsrc=4>-
I could not make this trick work; may be I am making a mistake.
@Wilfred van Rooijen- sorry that this is not a MWE.

Thank you all!

With best regards,
-Rohit.
Post by Ulrike Fischer
Post by RD Holkar
Dear all,
I am typesetting a memoir in Marathi using package Polyglossia. I found
that the package Background behaves strangely when used with XeLaTeX.
I am attaching an example in English which is clearly a (La)TeX file (I
can
Post by RD Holkar
send the file that uses Polyglossia if needed). I want two vertical lines
on the left and right side of the page (attachment- Background-LaTeX).
When
Post by RD Holkar
I use the package background and run LaTeX, I get the desired output.
However, when I run XeLaTeX on the same file, I get a displaced lines.
Moreover, I tried to place the lines by trial and error method, but, it
seems that the distortion is not linear.
\SetBgContents{
\begin{tikzpicture}[overlay,remember picture]
the background packages already uses tikzpicture and puts the
contents in a node. So you are basically nesting one tikzpicture in
another.
This can work, but it can also fail. See e.g.
https://tex.stackexchange.com/questions/46598/problem-with-
overlay-when-a-tikzpicture-is-inside-another-tikzpicture
https://tex.stackexchange.com/questions/398734/whats-wrong-
with-nested-tikzpicture-and-xelatex
and more.
So I wouldn't use the background package for this. Use e.g. eso-pic
to insert the drawing.
--
Ulrike Fischer
http://www.troubleshooting-tex.de/
--------------------------------------------------
http://tug.org/mailman/listinfo/xetex
Loading...