页眉中的完整图形与文本叠加在第一页的单列和双列上方

页眉中的完整图形与文本叠加在第一页的单列和双列上方

我在创建页眉时遇到了麻烦,页眉是一张全页拉伸图,上面覆盖着文本。还要将它与单列标题结合起来,然后是双列标题(后者我找到了解决方案,但不是其后的一般所需格式)。

我基本上想用乳胶制作以下首页模板:

在此处输入图片描述

它还要求其他页面只包含完整的标题图像(无文本)和与第一页相同的页码。我希望有更多精明的 tex 用户可以轻松制作上述模板。

请协助。

我尝试这样做,但失败了——我无法让页眉中的图像横跨整个页面(无缩进失败),也无法让投资策略部分位于右侧。我也无法在第二页上获得整齐的顶部规则比率——它太低了。

请参阅下面的代码:

%---------------------------------------------------------------

\documentclass[DIV=calc, paper=a4, twoside, twocolumn]{article}  % A4 paper and 11pt font size

        % Following packages allow huxtable to work:
        \usepackage{titling}
        \usepackage{lipsum}
        \usepackage{siunitx}
        \usepackage{multirow}
        \usepackage{hhline}
        \usepackage{calc}
        \usepackage{tabularx}
        \usepackage{xparse}
        \usepackage{longtable,booktabs}

        \usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template
        \usepackage[english]{babel} % English language/hyphenation
        \usepackage[protrusion=true,expansion=true]{microtype} % Better typography
        \usepackage{amsmath,amsfonts,amsthm} % Math packages
        \usepackage{sectsty} % Enables custom section titles
        \usepackage[svgnames, table]{xcolor} % Enabling colors by their 'svgnames'
        \usepackage[hang, normalsize,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
        \captionsetup{justification = raggedright, singlelinecheck = false}
        \usepackage{booktabs} % Horizontal rules in tables
        \usepackage{mdframed}
            \usepackage{float}
        \let\origfigure\figure
        \let\endorigfigure\endfigure
        \renewenvironment{figure}[1][2] {
            \expandafter\origfigure\expandafter[H]
        } {
            \endorigfigure
        }

        \let\origtable\table
        \let\endorigtable\endtable
        \renewenvironment{table}[1][2] {
            \expandafter\origtable\expandafter[H]
        } {
            \endorigtable
        }

        \usepackage{multicol}
        \usepackage{adjmulticol}
        %Psec Idios: Adjusted margins...
        \usepackage[margin=2.25cm,bottom=1.05cm,top=-0.18cm, headheight=3.5cm, headsep = 5pt, includefoot, includeheadfoot]{geometry}  
        %\usepackage[margin=2cm,bottom=4cm,top=3cm, includefoot]{geometry}
        \usepackage[none]{hyphenat}
        \usepackage{fancyvrb} % Added for disclaimer text file to be added later
        \usepackage[some]{background}
        \usepackage[round]{natbib}
        \usepackage{hyperref}
        \hypersetup{breaklinks=true,
        bookmarks=true,
        colorlinks=true,
        citecolor=Colorslink,
        urlcolor=Colorslink,
        linkcolor=Colorslink,
        pdfborder={0 0 0}}

        \urlstyle{same} 

        \definecolor{ColorsTitleFlag}{RGB}{25,62,107}
        \definecolor{ColorsSubTitleFlag}{RGB}{191,191,191}
        \definecolor{ColorsTitleBar}{RGB}{238,238,238}
        \definecolor{FrontPageHeader1}{RGB}{242,242,242}
        \definecolor{FrontPageHeader2}{RGB}{0,0,0}
        \definecolor{FrontPageHeader3}{RGB}{25,62,107}
        \definecolor{FrontPageHeaderSide}{RGB}{25,62,107}
        \definecolor{ColorsSection}{RGB}{0,71,107}
        \definecolor{ColorsSubSection}{RGB}{0,71,107}
        \definecolor{ColorsSubSubSection}{RGB}{0,71,107}
        \definecolor{ColorCaptionFont}{RGB}{0,71,107}
        \definecolor{Colorslink}{RGB}{0,71,107}

        \sectionfont{\color{ColorsSection}}
        \subsectionfont{\color{ColorsSubSection}}
        \subsubsectionfont{\color{ColorsSubSubSection}}

        \usepackage{fancyhdr} % Needed to define custom headers/footers
        \pagestyle{fancy} % Enables the custom headers/footers
        \usepackage{lastpage} % Used to determine the number of pages in the document (for "Page X of Total")
        \usepackage[bottom, hang, flushmargin]{footmisc}
        \usepackage{graphicx}
        \usepackage{lipsum}
            \usepackage{setspace}
        \setstretch{1.6}
            \fancypagestyle{firststyle}
        {
        \fancyhead[L]{
        Title 1 \\
        Subtitle
            \vspace{1.7cm}
        }
        \noindent \fancyhead[C]{\includegraphics[width=\paperwidth, height=2cm]{example-image-a} }

        \fancyhead[L]{
        Company Name \\
        Name
            \vspace{1.7cm}
        }

        }

        \fancyhead[C]{
         \noindent \includegraphics[width=\paperwidth, height = 3cm]{example-image-a}cm
            \vspace{1.7cm}
        }
        \fancyhead[L]{
            \bfseries
            \large \color{ColorsTitleFlag}{ Macro Strategy \\ August 2018}
            \vspace{2.25cm}
        }

        \fancyfoot[C]{}
        \fancyfoot[LE,RO]{\color{ColorsSubTitleFlag} \normalsize Page \thepage\ of \pageref{LastPage}} % Left side on Even pages; Right side on Odd pages

        \renewcommand{\headrulewidth}{0.2pt} 
        \renewcommand{\footrulewidth}{0.4pt} % Thin footer rule

        \IfFileExists{upquote.sty}{\usepackage{upquote}}{}


        % ========== HEADERS AND FOOTNOTES

        \setlength{\parskip}{0.8ex plus 1.5ex minus 2.5ex}

        %%% Use protect on footnotes to avoid problems with footnotes in titles
        \let\rmarkdownfootnote\footnote%
        \def\footnote{\protect\rmarkdownfootnote}

        \setcounter{secnumdepth}{3}   % 



        \NewDocumentCommand{\Colorbox}{O{\dimexpr\linewidth-2\fboxsep} m m}{%
            \colorbox{#2}{\makebox[#1][l]{#3}}}

                %----------------------------------------------------------------------------------------
                    % Adding raggedbottom avoids stretching across page if using twopage (as is done by default). See here: https://tex.stackexchange.com/a/10747/79853
                \raggedbottom
                %----------------------------------------------------------------------------------------


                    %----------------------------------------------------------------------------------------
                    %   Declaring figure caption fonts, color and positioning
                %----------------------------------------------------------------------------------------
                    \DeclareCaptionFont{Fnt}{\color{ColorCaptionFont}}

                \captionsetup{
                    position=below,
                    labelfont={bf,Fnt},
                    textfont={normal,Fnt},  % size, then color. Can sub normal for small, e.g.
                    justification=raggedright
                }


                \captionsetup{justification=raggedright,singlelinecheck=false} %    Set size in caption package argument above


                %%% Hard setting column skips for reports - this ensures greater consistency and control over the length settings in the document.

                %% page layout
                %% paragraphs
                \setlength{\baselineskip}{14pt plus 0pt minus 0pt}
                \setlength{\parskip}{12pt plus 0pt minus 0pt}
                \setlength{\parindent}{0pt plus 0pt minus 0pt}
                %% floats
                \setlength{\floatsep}{12pt plus 0 pt minus 0pt}
                \setlength{\textfloatsep}{20pt plus 0pt minus 0pt}
                \setlength{\intextsep}{14pt plus 0pt minus 0pt}
                \setlength{\dbltextfloatsep}{20pt plus 0pt minus 0pt}
                \setlength{\dblfloatsep}{14pt plus 0pt minus 0pt}
                %% maths
                \setlength{\abovedisplayskip}{12pt plus 0pt minus 0pt}
                \setlength{\belowdisplayskip}{12pt plus 0pt minus 0pt}
                %% lists
                \setlength{\topsep}{10pt plus 0pt minus 0pt}
                \setlength{\partopsep}{3pt plus 0pt minus 0pt}
                \setlength{\itemsep}{5pt plus 0pt minus 0pt}
                \setlength{\labelsep}{8mm plus 0mm minus 0mm}
                \setlength{\parsep}{\the\parskip}
                \setlength{\listparindent}{\the\parindent}

                \setlength{\fboxsep}{5pt plus 0pt minus 0pt}

                \usepackage{helvet}
                \renewcommand{\familydefault}{\sfdefault}



        \begin{document}


        \begin{minipage}{\textwidth}{%

        \thispagestyle{firststyle}
        \flushleft
                \fontsize{22pt}{10pt}
                \selectfont{John Doe}\\[2mm]
                \Large\textsc{\textit{Masters in Commerce, Phd}}\\[2mm]
                \fontsize{22pt}{10pt}
                \selectfont{Jane Doe}\\[2mm]
                \Large\textsc{\textit{Masters in Commerce}}\\[2mm]

                \flushright
                \fontsize{22pt}{10pt}
                \selectfont{Investment Strategy}}\\[2mm]
                \normalsize{\today}\\

                \hrule
                \newpage
        \end{minipage}\hfill



                                        %\twocolumn

                        \section*{Introduction} \label{summary}

                        \lipsum
                        \lipsum

                        \end{document}

答案1

感谢您提供更多详细信息!将任何东西放到任何地方的一种可能方法是使用 tikz。

\documentclass{article}
\usepackage[margin=1.23in]{geometry}
\usepackage{multicol}
\usepackage{tikz,tikzpagenodes}
\usepackage{eso-pic}
\usetikzlibrary{positioning,calc}
\usepackage{lipsum}
\AddToShipoutPictureBG*{
\begin{tikzpicture}[overlay,remember picture,text=white]
\path let \p1=($(current page.north east)-(current page.north west)$),
\p2=($(current page.north)-(current page text area.north)$)
in node at  ($(current page.north)+(0,-\y2/2)$)
{\includegraphics[width=\x1,height=\y2]{example-image-a}};
\path 
(current page text area.west |- current page.north) coordinate (tl)
rectangle (current page text area.north east) coordinate (br);
\node[font=\huge\bfseries\sffamily,anchor=north west] (mtitle1) 
at ([xshift=5mm,yshift=-5mm]tl){Title};
\node[font=\huge\bfseries\sffamily,anchor=north west] (subtitle)
at ([xshift=5mm,yshift=-15mm]tl){Subtitle};
\node[font=\huge\bfseries\sffamily,anchor=north east] (company) 
at ([xshift=-5mm,yshift=-5mm]tl-|br){Company};
\node[font=\huge\bfseries\sffamily,anchor=north east] (name)
at ([xshift=-5mm,yshift=-15mm]tl-|br){Name};
\end{tikzpicture}%
}
\begin{document}
\noindent
\begin{tikzpicture}
\node[anchor=west,font=\Large\sffamily] (author1){John Doe};
\node[anchor=west,below=1mm of author1,font=\large\sffamily] (desc1){Master in \dots};
\node[anchor=west,below=2mm of desc1,font=\Large\sffamily] (author2){Jane Doe};
\node[anchor=west,below=1mm of author2,font=\large\sffamily] (desc2){Master in \dots};
\node[anchor=east,font=\large\sffamily]
(title1)at([xshift=\linewidth-2mm]author1.west) {Investment strategy};
\node[anchor=east,below=1mm of title1,font=\large\sffamily](date){\today};
\path ([yshift=-3mm]desc2.south);
\end{tikzpicture}

\begin{multicols}{2}
\AddToShipoutPictureBG{
\begin{tikzpicture}[overlay,remember picture,text=white]
\path let \p1=($(current page.north east)-(current page.north west)$),
\p2=($(current page.north)-(current page text area.north)$)
in node at  ($(current page.north)+(0,-\y2/2)$)
{\includegraphics[width=\x1,height=\y2]{example-image-a}};
\end{tikzpicture}%
}
\section{Introduction}
\lipsum[1-12]
\end{multicols}
\end{document}

在此处输入图片描述

在此处输入图片描述

下面是使用选项(而不是使用)生成两列twocolumn的版本。我花了一段时间才明白articlemulticoltikzpicture需要加入一个团体。输出几乎与上面的相同。

\documentclass[DIV=calc, paper=a4, twoside, twocolumn]{article} 
\usepackage[margin=1.23in]{geometry}
\usepackage{tikz,tikzpagenodes}
\usepackage{eso-pic}
\usetikzlibrary{positioning,calc}
\usepackage{lipsum}
\AddToShipoutPictureBG*{
\begin{tikzpicture}[overlay,remember picture,text=white]
\path let \p1=($(current page.north east)-(current page.north west)$),
\p2=($(current page.north)-(current page text area.north)$)
in node at  ($(current page.north)+(0,-\y2/2)$)
{\includegraphics[width=\x1,height=\y2]{example-image-a}};
\path 
(current page text area.west |- current page.north) coordinate (tl)
rectangle (current page text area.north east) coordinate (br);
\node[font=\huge\bfseries\sffamily,anchor=north west] (mtitle1) 
at ([xshift=5mm,yshift=-5mm]tl){Title};
\node[font=\huge\bfseries\sffamily,anchor=north west] (subtitle)
at ([xshift=5mm,yshift=-15mm]tl){Subtitle};
\node[font=\huge\bfseries\sffamily,anchor=north east] (company) 
at ([xshift=-5mm,yshift=-5mm]tl-|br){Company};
\node[font=\huge\bfseries\sffamily,anchor=north east] (name)
at ([xshift=-5mm,yshift=-15mm]tl-|br){Name};
\end{tikzpicture}%
}
\begin{document}
\noindent
\twocolumn[{
\begin{tikzpicture}
\node[anchor=west,font=\Large\sffamily] (author1){John Doe};
\node[anchor=west,below=1mm of author1,font=\large\sffamily] (desc1){Master in \dots};
\node[anchor=west,below=2mm of desc1,font=\Large\sffamily] (author2){Jane Doe};
\node[anchor=west,below=1mm of author2,font=\large\sffamily] (desc2){Master in \dots};
\node[anchor=east,font=\large\sffamily]
(title1)at([xshift=\linewidth-2mm]author1.west) {Investment strategy};
\node[anchor=east,below=1mm of title1,font=\large\sffamily](date){\today};
\end{tikzpicture}}]
\AddToShipoutPictureBG{
\begin{tikzpicture}[overlay,remember picture,text=white]
\path let \p1=($(current page.north east)-(current page.north west)$),
\p2=($(current page.north)-(current page text area.north)$)
in node at  ($(current page.north)+(0,-\y2/2)$)
{\includegraphics[width=\x1,height=\y2]{example-image-a}};
\end{tikzpicture}%
}
\section{Introduction}
\lipsum[1-12]
\end{document}

相关内容