您的位置:首页 > 其它

LaTeX技巧一:如何在标题页面上创建背景图像?

2017-09-08 19:16 344 查看

eso-pic package和wallpaper package

我们先来看看eso-pic package。

eso-pic package

首先,假设你有一个名为background.png。那么你可以在

\begin{document}
添加以下代码:

\usepackage{eso-pic}
\newcommand\BackgroundPic{%
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\vfill
\centering
\includegraphics[width=\paperwidth,height=\paperheight,%
keepaspectratio]{background.png}%
\vfill
}}}


\begin{document}
之后添加:

\AddToShipoutPicture*{\BackgroundPic}


其中
*
将确保背景图片只会在一个页面上放置。

如果您想在多个页面上使用图片,请跳过
*


\AddToShipoutPicture{\BackgroundPic}


然后使用此命令停止使用背景图片:

\ClearShipoutPicture


wallpaper package

首先在导言区导入
\usepackage{wallpaper}


之后,您可以使用以下命令:

\ThisLRCornerWallPaper{0.5}{somerights.png}
\LRCornerWallPaper{0.5}{somerights.png}


其中
LRCorner-command
放置在页面右下角。

\ULCornerWallPaper
对于其他角落有诸如此类的命令。
\CenterWallPaper
以及
\TileWallPaper


用于对中或平铺图像。其中
this
为仅在当前页面上放置图像的地方。数值参数
{0.5}
将图像缩放为页面大小的0.5。

其中中心命令可选参数为
\ CenterWallPaper {scale} {filename}


有网友反应第一个包不能工作在某些情况下,可参考如下:

\usepackage{transparent}
\usepackage{eso-pic}
\newcommand\BackgroundPic{%
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\vfill
\centering
{\transparent{0.4} \includegraphics[width=\paperwidth,height=\paperheight,%
keepaspectratio]{background.png}}%
\vfill
}}}


Over!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  latex