5

I'm a LaTeX newbie. I want to create a page layout like in the picture below on every page.

Can someone help please? Thanks.

example

5

Update

According to comments, the first page has a different formatting. The code now uses a conditional to produce the desired results.

Here's one way to do it using the background and tikzpagenodes packages; the code needs two or three runs for the elements to reach their final locations:

enter image description here

The code:

\documentclass{article}
\usepackage[scale=1,angle=0,opacity=1,color=black]{background}
\usepackage{tikzpagenodes}
\usepackage{lipsum}

\newlength\FrameHShift
\newlength\FrameVShiftT
\newlength\FrameVShiftB
\setlength\FrameHShift{20pt}
\setlength\FrameVShiftT{15pt}
\setlength\FrameVShiftB{75pt}

\backgroundsetup{
  contents={%
  \begin{tikzpicture}[overlay]
  \coordinate (nw) at ([shift={(-\FrameHShift,\FrameVShiftT)}]current page text area.north west);
  \coordinate (ne) at ([shift={(\FrameHShift,\FrameVShiftT)}]current page text area.north east);
  \coordinate (sw) at ([shift={(-\FrameHShift,-\FrameVShiftB)}]current page text area.south west);
  \coordinate (se) at ([shift={(\FrameHShift,-\FrameVShiftB)}]current page text area.south east);
  \draw
    (nw) --
    (ne) --
    (se) --
    (sw)-- cycle;
  \ifnum\value{page}=1
  \node[
    draw,
    anchor=south west,
    text width=0.25\textwidth,
    minimum height=10ex,
    align=center,
    yshift=-\pgflinewidth
    ]
    at (nw)
    (text4)
    {text d \\ text d};
  \node[
    draw,
    anchor=south west,
    text width=0.25\textwidth,
    minimum height=5ex,
    align=center,
    yshift=-\pgflinewidth
    ]
    at (text4.north west)
    (text1)
    {text a};
  \node[
    draw,
    anchor=south west,
    text width=0.5\textwidth,
    minimum height=5ex,
    align=center,
    xshift=-\pgflinewidth
    ]
    at (text1.south east)
    (text2)
    {text b};
  \node[
    draw,
    anchor=south west,
    text width=\dimexpr0.25\textwidth+2\FrameHShift-\pgflinewidth\relax,
    minimum height=5ex,
    align=center,
    xshift=-\pgflinewidth
    ]
    at (text2.south east)
    (text3)
    {text c};
  \node[
    draw,
    anchor=south west,
    text width=\dimexpr0.75\textwidth+2\FrameHShift-\pgflinewidth\relax,
    minimum height=10ex,
    align=center,
    xshift=-\pgflinewidth
    ]
    at (text4.south east)
    (text5)
    {text e \\ text e};
  \node[anchor=north]
    at ([yshift=-50pt]current page text area.south)
    {Page~\thepage};
  \else
  \node[
    draw,
    anchor=south west,
    text width=0.25\textwidth,
    minimum height=5ex,
    align=center,
    xshift=-0.5\pgflinewidth,
    yshift=-\pgflinewidth
    ]
    at (nw)
    (text1)
    {text a};
  \node[
    draw,
    anchor=south west,
    text width=0.5\textwidth,
    minimum height=5ex,
    align=center,
    xshift=-\pgflinewidth
    ]
    at (text1.south east)
    (text2)
    {text b};
  \node[
    draw,
    anchor=south west,
    text width=\dimexpr0.25\textwidth+2\FrameHShift\relax,
    minimum height=5ex,
    align=center,
    xshift=-\pgflinewidth
    ]
    at (text2.south east)
    (text3)
    {text c};
  \fi    
   \end{tikzpicture}%
  }
}

\pagestyle{empty}

\begin{document}

\lipsum[1-30]

\end{document}

Three auxiliary length allow easily customization:

  • \FrameHShift, horizontal separation between the text and the frame.
  • \FrameVShiftT, vertical separation between text and the lower part of the header.
  • \FrameVShiftB, vertical separation between text and lower part of the frame.
  • Gonzalo, This is exactly what I want for my 1st page. The rest of them are a little bit different but I'll try to learn and adapt yours to fit my need. I might come back with more questions. Thanks. – kmmm Aug 29 '15 at 3:50
  • @kmmm -- How do you want the pages to look like from the second on? – Ruben Aug 30 '15 at 21:34
  • Ruben, Thanks for asking about the second page. It looks like the first page without a second row. I'll adjust yours and Gonzalo after I learn new commands. Both your and Gonzalo have many new commands that I never used before. So, I've to get familiar with it. I previously used just only the common packages for my thesis. – kmmm Sep 1 '15 at 3:05
  • @kmmm I updated my answer providing a different formatting from the second page on. – Gonzalo Medina Sep 2 '15 at 15:31
  • 1
    @kmmm Glad I could help. Yes, using conditional tests you can decide what to place on selected pages. – Gonzalo Medina Sep 4 '15 at 1:55
7

Since you want to have the layout for every page you could define a header containing a table instead of making the whole page a table, i.e. \chead{\begin{tabular} ... \end{tabular}} (with help of the standard package fancyhdr). In the final solution I used tabularx to build the actual table:

\documentclass{article}
\usepackage[top=125pt,headheight=75pt,headsep=10pt]{geometry}
\usepackage{fancyhdr}
  \pagestyle{fancy}
  \fancyhf{}
  \chead{%
    \renewcommand{\arraystretch}{1.75}%
    \begin{tabularx}{\textwidth}{|c|>{\centering\arraybackslash}X|c|}
      \hline
      Text here & Text here & Text here \\[5pt]
      \hline
      Text here & \multicolumn{2}{c|}{%
        \vtop{%
          \hbox{\strut Text here}
          \hbox{\strut Text here}
        }
      } \\[15pt]
      \hline
    \end{tabularx}%
  }
  \cfoot{\thepage}
  \renewcommand{\headrulewidth}{0pt}
\usepackage{tabularx}
\makeatletter
\newdimen\@ht
\@ht\dimexpr\textheight+\headheight+\headsep+2em\relax
\AtBeginDocument{%
  \leftskip1em
  \rightskip1em
  \AtBeginDvi{%
    \moveright\@themargin%
    \vbox to\z@{\baselineskip\z@skip\lineskip\z@skip\lineskiplimit\z@%
      \hbox to\textwidth{%
        \llap{\vrule height\@ht}\hfil%
        \vrule height\@ht
      }%
      \vbox to\z@{\vss\hrule width\textwidth}%
      \vss
    }
  }
}
\makeatother

\begin{document}
\vspace*{0.3\textwidth}
{\LARGE\centering Text here\par}
\end{document}

output

  • Ruben - This is what I want. Thank you so much. – kmmm Aug 29 '15 at 3:46

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.