# No space between vertical rule and image

I want to design a titlepage for a beamer presentation (XeLaTeX, Miktex 2.9-64, Win7-64) and need to reduce the space between a rule and a graphic to 0.

My code:

\setbeamertemplate{background}
{\hspace{0.6\paperwidth}
\rule{0.1cm}{\paperheight}
\includegraphics[width=0.4\paperwidth,height=\paperheight]{mypicture}}


My result:

In the image above, the space I want gone is marked in red. What do I need to do?

• Add a % after \rule{0.1cm}{\paperheight}. Edit: see questions linked to in meta.tex.stackexchange.com/a/2429/586 – Torbjørn T. Sep 10 '13 at 10:14
• I'd add a % also after \hspace{0.6\paperwidth} – egreg Sep 10 '13 at 10:24

You have spurious spaces and, moreover, the construction will be wider than \paperwidth.
\setbeamertemplate{background}

The % mask off the end-of-line which would count as an interword space; the negative \hspace command compensates for the rule width.