17

I want to produce this particular template in LaTeX. With no page numbering, and rectangles in colours in a a4paper.

sample made with Word

hsigrist
  • 682
  • Should "Natural Sciences" be placed at the top of every page (of a particular chapter)? – lockstep Nov 01 '11 at 12:44
  • 6
    I think this question is too localised. "How to create this exact layout" is not a good question for the Q&A format. Perhaps rephrase the question to ask about one specific thing you're having trouble doing. What have you tried so far? – Seamus Nov 01 '11 at 12:46
  • yes, at the top of every different chapter. – hsigrist Nov 01 '11 at 12:47
  • I need this templates for print first, then in this templates print the document... So i want to produce 4 templates like this but in different colours and whit different title. – hsigrist Nov 01 '11 at 12:50
  • @Seamus I disagree. It can serve as a good example for future visitors. I think one compare it to questions like "how can I draw ... with tikz?". The OP has a problem and is looking for an answer. The question is clearly formulated and the solution is probably a general solution. (That said, I don't know how to do this in LaTeX.) – topskip Nov 01 '11 at 12:59
  • 3
    @Patrick: This question shows no effort whatsoever. At least getting rid of page numbers is trivial (to find out about), even for beginners. Finding out about headers isn't too hard, either. The colored box is trickier; asking about that would be a specific and valid question. The way it is now, it smells too much like "please do the work for me" if you're asking me. Thinking about tex.sx as a resource for other users, it's pretty unlikely other users will benefit a lot from this question, unless they're searching for "this particular template" ... – doncherry Nov 01 '11 at 13:15
  • @Seamus you're right of course with the little effort. That's a case for a downvote. But I still believe that generating a colored header is not too localized and valuable for future users. – topskip Nov 01 '11 at 13:26
  • 1
    Have a look at Title page using TikZ which should also work for general headers. Just put the tikzpicture environment in the header. – Martin Scharrer Nov 01 '11 at 13:28
  • 4
    No page numbering trivial: agree. Colored box trivial: agree. But this color box in header is not trivial for me, and that is the question, and I dont want "anyone do the work for me", maybe my english is poor (Im Chilean Math&Stat teacher at University) sorry for that but this Q&A format page is the best way to question for that... And I love this page (Is my Homepage in Safari!!). – hsigrist Nov 01 '11 at 13:32
  • @hsigrist: Thanks for your feedback. Sorry if we were being a bit harsh. Here's what I would suggest (even though there's an answer already): Edit your question and include the code for a document without page numbers and with a colored box in the body (-> this is what you've got, à la "show your work"). Reformulate your question (including the title) to something like "How to get a colored box as the header?" or "Colored box as page header". – doncherry Nov 01 '11 at 13:37
  • 2
    @Patrick If the question were rephrased to "How do I create a coloured header, then I think it would be a great, focused, answerable, useful question. How about it, @hsigrist? – Seamus Nov 01 '11 at 15:19

1 Answers1

18

Eventhough this question does not show a large amount of effort on your part, you can remove page numbering with \thispagestyle{empty}. To draw the box you desire at the top of the page, you can use TikZ.

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\def\particulartemplate#1{
  \thispagestyle{empty}
  \begin{tikzpicture}[overlay, remember picture]
    \draw let \p1 = (current page.west), \p2 = (current page.east) in
      node[minimum width=\x2-\x1, minimum height=2cm, draw, rectangle, fill=blue!20, anchor=north west, align=left, text width=\x2-\x1] at ($(current page.north west)$) {\Large\bfseries \quad #1};
  \end{tikzpicture}
}
\begin{document}
  \chapter{Chapter one}
    \particulartemplate{NATURAL SCIENCES}
    \lipsum[1-7]
\end{document}

This will make every page on which you invoke \particulartemplate{Text for box} to be layed out according to your particular template. The example code provided will look like this:

page with box typeset at top

It should be relatively straightforward to modify this code to be a little more flexible. (As in, take the color as an argument, whether or not there should be a border, how the text should be justified, etc.)

Roelof Spijker
  • 17,663
  • 5
  • 55
  • 63
  • I use texlive2011, compile this code under PDFTeXify two times, then get the image. But when I compile it under XeLaTeX two times, the "NATURAL SCIENCES" is in the top of the box. Sometimes, XeLaTeX makes a problem. – Pig Cry Nov 01 '11 at 14:12
  • You can make this appear on every page with usepackage{atbegshi} and \AtBeginShipout{\AtBeginShipoutUpperLeft{\raisebox{-\height}{\particulartemplate{Natural sciences}}}} – CPBL Jul 16 '20 at 17:27