Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to create a complex template for documentation as a document class.

I should be able to define my text fields (for instance, \documentNumber, \projectTitle). My class should be flexible enough to accomodate landscape pages as well. XeTeX is preferrable.

This is a sketch of how the document template should look like:

Layout sketch

The only idea I had was to create a tikzpicture on every page, as described in my other question. I got recommendations for using everypage, everyshi and such. I was hoping for more specific answers. Code snippets or just outlined concepts for coding are most welcome.

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

Following Matthew's prediction, this is how I would do this layout in ConTeXt. The table at the top can be set as a header. The callouts on the left margin can be set using layers. We can add frames (borders) by carefully adding frame=on or frame=off to different elements. The rest is just a matter of setting the right margin's etc.



% Header

% Left margin
\definelayer [leftlayer] 


\setlayer        [leftlayer] [preset=leftbottom] 
                 {\rotate{\margincallout[rightframe=on]{Rotated text callout 1} }}

\setlayer        [leftlayer] [preset=lefttop,y=2.5mm]
                 {\rotate{\margincallout {Rotated text callout 2} }}


% Actual content
\startsetups header
      \bTD[nr=3]      \fakewords {5} {10} \eTD
      \bTD[nr=3,nc=2] \fakewords {5} {10} \eTD
      \bTD \fakewords{1}{3}               \eTD
       \bTD \fakewords{1}{3} \eTD
      \bTD \fakewords{1}{3} \eTD
      \bTD \fakewords{1}{2} \eTD
      \bTD \fakewords{1}{2} \eTD
      \bTD \fakewords{1}{2} \eTD
      \bTD \fakewords{1}{2} \eTD

% For dummy text
Page Content

The output looks as follows:enter image description here

share|improve this answer
I will accept your answer. It seems elegant and usable. As I don't have experience with ConTeXt, I'll also try and sketch my progress in LaTeX as a separate answer. –  ipavlic Feb 25 '11 at 11:59
one of these days I will go beyond predicting a context solution and actually try to write one. :) –  Matthew Leingang Mar 1 '11 at 12:55
add comment

You might try the textpos package or some of the other solutions described on the UK TeX FAQ page "Putting things at fixed positions on the page".

If you are comfortable using TikZ to do this kind of thing don't be afraid to. Yes, it's a lot of "overhead" but it works.

Although I know very little about it I hear ConTeXt does this kind of thing well. So we should be getting an answer from one of their users soon.

share|improve this answer
add comment

I have managed to solve my requirement with your generous help. I'm not very satisfied with the overall hackishness, but it solves my requirements. Hopefully it might be helpful to someone else.




\projecttitle{My project name}
\metadataTwo{Metadata Two}
\metadataThree{Metadata Three}
\metadataFour{Metadata Four}
\metadataFive{Metadata Five}
\metadataSix{Metadata Six}


\section{Phasellus eu tellus}

Document class:




\setmainfont{Minion Pro}


\tikzstyle{content box}=[]







\setlength{\rightcolumnswidth}{\framewidth - \logoandtitlewidth}



            \rule{\logowidth-2\padding}{2cm}% graphic dummy

        \centering\large\textsc{Project name}\linebreak\textbf{\@projecttitle}}

        \parbox{\rightcolumnswidth-2\padding}{Metadata: \@metadata}

        \parbox{\rightcolumnswidth-2\padding}{Metadata: \@metadataTwo}

        \parbox{\rightcolumnswidth-2\padding}{Metadata: \@metadataThree}

        \parbox{\logowidth-2\padding}{Metadata: \@metadataFour}

        \parbox{0.5\titlewidth-2\padding}{Metadata: \@metadataFive}

        \parbox{0.5\titlewidth-2\padding}{Metadata: \@metadataSix}

        \parbox{\rightcolumnswidth-2\padding}{\hphantom{Page: 123 of 123}}











    %45 points is sligtly more than 1,5 cm

    \pgfmathsetlength{\headerheight}{\headerfirstrowheight + max(\contractnumheight,\projectnumheight,\bookheight,\pagenumheight)+12pt}


        \begin{tikzpicture}[remember picture, overlay, semithick, black, inner sep=0, outer sep=0]%
        %Outer frame
        \node (frame) at ($(current page.center)+(0.5cm,0)$) [minimum width=\paperwidth-3cm,minimum height=\paperheight-2cm, draw] {};%
        %Copyright divider
        \draw ($(current page.west)+(0.2cm,0)$) -- ($(current page.west)+(1.8cm,0)$);%
        %Revision information
        \node (revision information) at ($(frame.north west)!0.98!(frame.south west)$) [content box, xshift=-0.4cm, anchor=west, rotate=90] {\tiny Revision information text};%
        %Copyright notice Croatian
        \node (copyright hrvatski) at ($(frame.north west)!0.75!(frame.south west)$) [content box, xshift=-1cm, rotate=90] {\parbox{0.25\frameheight}{\tiny\centering \lipsum[13]}};%
        %Copyright notice English
        \node (copyright english) at ($(frame.north west)!0.25!(frame.south west)$) [content box, xshift=-1cm, rotate=90] {\parbox{0.25\frameheight}{\tiny\centering \lipsum[13]}};%
        \node (logo) at (frame.north west) [content box,anchor=north west,outer sep=\padding] {\usebox{\logobox}};%
        \node (title) at ($(frame.north west)!\logowidthratio!(frame.north east)$) [content box,anchor=north west, outer sep=\padding] {\usebox{\titlebox}};%
        %metadata metadata
        \node (metadata) at ($(frame.north west)!\logowidthratio+\titlewidthratio!(frame.north east)$) [content box,anchor=north west,outer sep=6pt] {\usebox{\metadatabox}};%
        %Document number metadata
        \node (document number) at ($(frame.north west)!\logowidthratio+\titlewidthratio!(frame.north east)$) [content box,anchor=north west, yshift=-0.33\headerfirstrowheight,outer sep=6pt] {\usebox{\docnumbox}};%
        %Revision metadata
        \node (revision) at ($(frame.north west)!\logowidthratio+\titlewidthratio!(frame.north east)$) [content box,anchor=north west, yshift=-0.66\headerfirstrowheight,outer sep=6pt] {\usebox{\revisionbox}};%
        %Contract number metadata
        \node (contract number) at ($(frame.north west)-(0,\headerfirstrowheight)$) [content box,anchor=north west,outer sep=6pt] {\usebox{\contractnumbox}};%
        %Project number metadata
        \node (project number) at ($(frame.north west)-(0,\headerfirstrowheight)$) [content box,anchor=north west,xshift=\logowidth,outer sep=6pt] {\usebox{\projectnumbox}};%
        %Book number
        \node (book number) at ($(frame.north west)-(0,\headerfirstrowheight)$) [content box,anchor=north west,xshift=\logowidth+0.5\titlewidth,outer sep=6pt] {\usebox{\bookbox}};%
        %Page number
        \node (page number) at ($(frame.north west)-(0,\headerfirstrowheight)$) [content box,anchor=north west,xshift=\logowidth+\titlewidth,outer sep=6pt] {Page: \thepage\ of \pageref{LastPage}};%
        %First header row horizontal bottom line
        \draw ($(frame.north west)-(0,\headerfirstrowheight)$) -- ($(frame.north east)-(0,\headerfirstrowheight)$);%
        %Header horizontal bottom line
        \draw ($(frame.north west)-(0,\headerheight)$) -- ($(frame.north east)-(0,\headerheight)$);%
        %Third header column, first row horizontal bottom line
        \draw ($($(frame.north west)!\logowidthratio+\titlewidthratio!(frame.north east)$)-(0,.33\headerfirstrowheight)$) -- ($(frame.north east)-(0,.33\headerfirstrowheight)$);%
        %Third header column, second row horizontal bottom line
        \draw ($($(frame.north west)!\logowidthratio+\titlewidthratio!(frame.north east)$)-(0,.66\headerfirstrowheight)$) -- ($(frame.north east)-(0,.66\headerfirstrowheight)$);%
        %First header column vertical right line
        \draw ($(frame.north west)!\logowidthratio!(frame.north east)$) -- ($(frame.north west)!\logowidthratio!(frame.north east) - (0,\headerheight)$);%
        %Second header column vertical right line
        \draw ($(frame.north west)!\logowidthratio+\titlewidthratio!(frame.north east) - (0,\headerheight)$) -- ($(frame.north west)!\logowidthratio+\titlewidthratio!(frame.north east)$);%
        %Second header row middle vertical
        \draw ($(frame.north west)+(\logowidth+0.5\titlewidth,-\headerfirstrowheight)$) -- ($(frame.north west)+(\logowidth+0.5\titlewidth,-\headerheight)$);%
share|improve this answer
Rather than creating the header using tikz, why not use a simple table as the header? –  Aditya Feb 25 '11 at 19:51
I had problems with finetuning a table to my requirements (tex.stackexchange.com/questions/12030/table-cell-overflow). –  ipavlic Feb 26 '11 at 11:22
It's great that you post an answer showing how far you got. However, it's really discouraged to ask questions in an answer, and you probably won't get any answers this way. So it would be best if you just describe in this answer that this is how far you got, and then post a new question where you ask "Can it be done somehow, without resorting to everypage?". In this new question you can put a link to this post to provide the background. –  Hendrik Vogt Mar 1 '11 at 11:42
Thank you Hendrik, I've already done that, but haven't removed the question here. I will do so now. –  ipavlic Mar 1 '11 at 12:20
Great, thanks! –  Hendrik Vogt Mar 1 '11 at 13:24
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.