设置页面部分的背景颜色

设置页面部分的背景颜色

我正在使用回忆录课程和给出的提示设计名片这里我正在尝试各种背景效果。具体来说,我想将卡片最后三分之一的背景更改为另一种颜色。由于颜色需要延伸到边缘,因此涉及表格的选项不合适。除了插入图像并覆盖它之外,有没有更优雅的方法来实现这一点?

答案1

当我正确理解您的要求时,您无论如何都需要一个 90mm x 52mm 的 PDF。因此,我建议您使用以下方法“绘制”卡片蒂克兹。您可以在此处将背景颜色设置为填充矩形。使用preview包最小化生成的 PDF 页面。以下代码使用standalone自动执行此操作。

TikZ 支持许多图形功能,如阴影等,因此您不会遇到任何限制。请参阅此问题如果您想在普通页面的背景上绘图。

\documentclass[border=0mm]{standalone}
\usepackage{tikz}
\begin{document}
\sffamily
\begin{tikzpicture}
    % Define size and default background color of card:
    \useasboundingbox [fill=blue!10] (0,0) rectangle (90mm,52mm);
    % Background of last third
    \fill [red] (60mm,0mm) rectangle (90mm,52mm);
    % Place the text freely. You can also place `tabulars` or `\parbox`es
    \node [right] at (10mm,30mm) {John Doe};
    \node [right] at (10mm,25mm) {Example Cooperation};
    \node [right] at (10mm,20mm) {[email protected]};
\end{tikzpicture}
\end{document}

结果:

结果

答案2

您可以使用简单的颜色框

\documentclass{article}
\usepackage{xcolor,lipsum}
\begin{document}

\lipsum[1]

\noindent\fboxsep=0pt%
\colorbox{blue!10}{\parbox[c][0.5\textwidth][c]{0.7\textwidth}{%
\centering\large\tabular{l}
John Doe\\Example Cooperation\\[email protected]
\endtabular}}%
\colorbox{red}{\parbox[c][0.5\textwidth][c]{0.3\textwidth}{\rule{\linewidth}{0pt}}}

\end{document}

在此处输入图片描述

答案3

你可以使用eso-picatbegshieveryshi(较旧)或textpos(易于使用)将颜色填充的矩形放入背景中。

或者,你可以使用 TikZ 和current page节点。下面是我将此方法用于标题和页眉的示例:使用 TikZ 制作精美的章节标题。 看评论#20例如,带有彩色标题。可以根据需要进行修改。

相关内容