4

I would like to add some image or maybe some color picture in the page background. However, I would like to leave some margin space.

The darker area is out of the page. The mais page color is white and the background is lightgray.

I use xelatex because of other resources.

See picture below:

example image

4

You can use the background package, but indeed it can be tricky to get the position right! Please see the following example in which I set a random picture as background at fixed margins using the hshift and vshift settings, following your image:

% !TeX program  = xelatex
\documentclass{article}
\usepackage{background,lipsum}

\backgroundsetup{
    scale=1,
    color=black,
    opacity=1,
    contents={%
        \includegraphics[%
            height=\dimexpr\paperheight-2cm\relax, % double the vert. margin
            width=\dimexpr\paperwidth-2cm\relax    % double the horiz. margin
            ]{example-image-a}
    },
    angle=0,
    position = current page.south west,
    nodeanchor = south west,
    hshift = 1cm, % horizontal margin
    vshift = 1cm  % vertical margin
}

\begin{document}
\lipsum[1-10]
\end{document}

enter image description here

0

I solved my question with this:

\usepackage{background}
\definecolor{myColor}{RGB}{234,234,234}
\backgroundsetup{
    contents={
        \begin{tikzpicture}
            \fill[myColor] (0,0) rectangle (18.5,28);
            \end{tikzpicture}
    },
    angle=0,
    scale=1
}

Thanks for the help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.