summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/litesolution/tex/titleimage.sty
blob: 0a4972aae198840730815e2342be5276ba4ff3be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\ProvidesPackage{titleimage}[2024/03/08/ v0.1 Package for adding south-shading full width picture on the top of page.]

\RequirePackage{tikz,xcolor}
\usetikzlibrary{shadings}
\definecolor{titleline}{HTML}{006E54} %

\newsavebox\imagebox % goes into the preamble
\NewDocumentCommand{\titleimage}{ o m }{
    \tikz[remember picture,overlay]
    {
        \node[scope fading=south,anchor=north,inner sep=0pt,outer sep=auto] at (current page.north) {\includegraphics[width=\paperwidth]{#2}};
        \IfNoValueF{#1}{
            \fill [backgroundcolor!40,opacity=0.5] ($(current page.north west)-(0,3.5/13*\paperwidth)$) rectangle +(\paperwidth,-\paperwidth/13); % 中间
            \draw [line width=2pt,titleline!40] ($(current page.north west)-(0,3.5/13*\paperwidth)$) -- ($(current page.north east)-(0,3.5/13*\paperwidth)$); % 上线
            \draw [line width=2pt,titleline!40] ($(current page.north west)-(0,4.5/13*\paperwidth)$) -- ($(current page.north east)-(0,4.5/13*\paperwidth)$); % 下线
            \node at ($(current page.north west)-(-0.5*\paperwidth,4/13*\paperwidth)$) {#1};
        }
    }
}