9

I want to insert a sentence (Author's personal copy) at the top of the page which is centered. I don't want a header with line. Just want to add a sentence (bold or italic). How can I add that for

  1. first page only

  2. each page

2

3 Answers 3

9

On only one page:

\documentclass{article}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}[remember picture, overlay]
      \node[draw,minimum width=4in,fill=olive!40,text=magenta,font=\LARGE\bfseries] at ([yshift=-1cm]current page.north)  {Author's personal copy};
    \end{tikzpicture}
    Some text comes here

\end{document}

enter image description here

On all pages:

Using background package:

\documentclass{article}
\usepackage{background}

\backgroundsetup{
angle=0,
scale=1,
opacity=1,
color=black,
contents={%
\begin{tikzpicture}[remember picture, overlay]
      \node[draw,minimum width=4in,fill=olive!40,text=magenta,font=\LARGE\bfseries] at ([yshift=-1cm]current page.north)  {Author's personal copy};
    \end{tikzpicture}
}
}
\begin{document}

    Some text comes here
    \clearpage
    Some text again

\end{document}

enter image description here

Using eso-pic package with only text as requested:

\documentclass{article}
\usepackage{tikz,eso-pic}

\AddToShipoutPicture{%
\begin{tikzpicture}[remember picture, overlay]
      \node[minimum width=4in,font=\bfseries] at ([yshift=-1cm]current page.north)  {Author's personal copy};
    \end{tikzpicture}%

}

\begin{document}

    Some text comes here
    \clearpage
    Some text again

\end{document}

enter image description here

2
  • That is fine. Still I need a simple layout without box or color. Just a sentence
    – mahmood
    Apr 19, 2014 at 14:36
  • @mahmood See the last code with eso-pic. I simplified the node. You have to remove the options given to \node.
    – user11232
    Apr 19, 2014 at 14:39
5

I would suggest using eso-pic with the following setup:

\usepackage{eso-pic}% http://ctan.org/pkg/eso-pic

\AddToShipoutPictureBG{%
  \AtPageUpperLeft{%
    \makebox[\pdfpagewidth]{\raisebox{\dimexpr-\height-20pt}{%
      \large Author's personal copy
    }}%
  }%
}

The above places the required text 20pt below the top margin of the page boundary and can be used as-is in the preamble. Use \AddToShipoutPictureBG* for a page-only addition. There's also a \..FG option if you want to place content in the ForeGround (as opposed to the BackGround).

1
  • Thanks! To make it possible to have more than one line of text, I swapped \raisebox and \makebox (with their parameters), and replaced \makebox with \parbox. Feb 11, 2023 at 8:08
1

You can use the titlesec package with pagestyles option, and define a new page style, say "copy" (the formatting is up to you, to be put in the middle argument of sethead:

\newpagestyle{copy}{%
\sethead{}{\small Author's personal copy}{}
\setfoot{}{\thepage}{}}% 

As a title rule is not asked for, you won't have one. Then call \pagestyle{copy} in your preamble (case 2) or thispagestyle{copy} at the beginning of your document (case 1).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .