0

How to have a full box that covers the edge of a paper instead of having to define \lhead{} \chead{} \rhead{}, \lfoot{} \cfoot{} \rfoot{}. Also the foot is not at the edge of paper neither the head. How to adjust the boxes to cover the edges. Also what is the command to draw a vertical box vbox at the left and one at the right that covers the edge of the paper. What I want is draw a color box that covers the edge of the paper so my lipsum would stay inside.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}         % Latin Modern fonts
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{geometry}

\geometry{
  height=180mm,
  width=180mm,
 left=0mm,
 right=0mm,
 top=0mm,
headheight=0mm, 
textheight=20cm,
 }
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage[many]{tcolorbox}

\usepackage{fancyhdr}
\pagestyle{fancy}

\lhead{\parbox[b][21mm][c]{10cm}{\tcboxfit[colback=blue,colframe=blue,width=10cm,height=2cm,fit basedim=20pt,fit fontsize macros,valign=center,frame style={fill=blue}]{\centering \textcolor{white}{\bfseries Test Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}}}}
\chead{\parbox[b][21mm][c]{10cm}{\tcboxfit[colback=blue,colframe=blue,width=10cm,height=2cm,fit basedim=20pt,fit fontsize macros,valign=center,frame style={fill=blue}]{\centering \textcolor{white}{\bfseries Test Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}}}}
\lfoot{\parbox[b][21mm][c]{10cm}{\tcboxfit[colback=red,colframe=red,width=10cm,height=2cm,fit basedim=20pt,fit fontsize macros,valign=center,frame style={fill=red}]{\centering \textcolor{white}{\bfseries Test Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}}}}
\rfoot{\parbox[b][21mm][c]{10cm}{\tcboxfit[colback=red,colframe=red,width=10cm,height=2cm,fit basedim=20pt,fit fontsize macros,valign=center,frame style={fill=red}]{\centering \textcolor{white}{\bfseries Test Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}}}}
\begin{document}
\lipsum[1]
\newpage
\lipsum[1]
\end{document}
1

Is this the kind of design you need:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}         % Latin Modern fonts
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[hmargin=1cm, vmargin=3cm]{geometry}
%\usepackage{layout} % checking things


\usepackage{lipsum}
\usepackage{xcolor}
\usepackage[many]{tcolorbox}


\usepackage{eso-pic}
\usepackage{picture}

\AddToShipoutPictureBG{%
    \put(0,\paperheight){\raisebox{-\height}{\tcboxfit[colback=blue, colframe=blue,
    width=10cm, height=2cm, fit basedim=20pt, fit fontsize macros, frame
    style={fill=blue}]{\centering \textcolor{white}{\bfseries Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis.}}}}%
%
    \put(\paperwidth,\paperheight){\llap{\raisebox{-\height}{\tcboxfit[colback=blue, colframe=blue,
    width=10cm, height=2cm, fit basedim=20pt, fit fontsize macros, frame
    style={fill=blue}]{\centering \textcolor{white}{\bfseries Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis.}}}}}%
%
    \put(\paperwidth,0){\llap{\tcboxfit[colback=red, colframe=red,
    width=10cm, height=2cm, fit basedim=20pt, fit fontsize macros, frame
    style={fill=red}]{\centering \textcolor{white}{\bfseries Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis.}}}}%
%
    \put(0,0){\tcboxfit[colback=red, colframe=red,
    width=10cm, height=2cm, fit basedim=20pt, fit fontsize macros, frame
    style={fill=red}]{\centering \textcolor{white}{\bfseries Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis.}}}%
}


\begin{document}
%\layout
\lipsum[1-18]
\end{document}

enter image description here


Perhaps according to comments you are more after something like this

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}         % Latin Modern fonts
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[hmargin=5cm, vmargin=3cm]{geometry}
%\usepackage{layout} % checking things


\usepackage{lipsum}
\usepackage{xcolor}
\usepackage[many]{tcolorbox}


\usepackage{eso-pic}
\usepackage{picture}

\usepackage{ragged2e}

\AddToShipoutPictureBG{%
% HEAD
    \put(0,\dimexpr\paperheight-2cm\relax){\tcboxfit[colback=blue, colframe=blue,
    width=\paperwidth, height=2cm, fit basedim=20pt, fit fontsize macros, frame
    style={fill=blue}, sharp corners]{\centering \textcolor{white}{\bfseries Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis.}}}%
%
% FOOT
    \put(0,0){\tcboxfit[colback=red, colframe=red,
    width=\paperwidth, height=2cm, fit basedim=20pt, fit fontsize macros, frame
    style={fill=red}, sharp corners]{\centering \textcolor{white}{\bfseries Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis.}}}%
% %
% LEFT VERTICAL (width=4cm, inner margin = 0.5cm each side)
  \put(0,2cm){\fboxsep0pt \colorbox{green}{\kern.5cm\parbox[b][\dimexpr\paperheight-4cm][c]{3cm}{\bfseries
        \RaggedRight\color{white}Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis. Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis. Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis. Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis. Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis. }\kern.5cm}}
%
% RIGHT VERTICAL (width=4cm, inner margin = 0.5cm each side)
  \put(\dimexpr\paperwidth-4cm,2cm){\fboxsep0pt \colorbox{magenta}{\kern.5cm\parbox[b][\dimexpr\paperheight-4cm][c]{3cm}{\bfseries
        \RaggedLeft\color{white}Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis. Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis. Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis. Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis. Test Lorem ipsum
        dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
        vestibulum ut, placerat ac, adipiscing vitae, felis. }\kern.5cm}}
%
}


\begin{document}
%\layout
\lipsum[1-18]
\end{document}

Produces

enter image description here Notice I have used simple parboxes for the side with no font scaling. And possibly the top and bottom could also be done with \scalebox avoiding usage of tcolorbox package.

It is not clear to me if this is expected design. The page number will need some handling, perhaps moving it higher up thanks to geometry options.

  • Thanks jfbu I need also the same boxes at left and right of the paper. How to get rid of rounded corners ? – Houda Araj Oct 25 '17 at 16:14
  • add sharp corners option to \tcboxfit. Notice that in such cases much lower weight methods than loading tcolorbox package exist. (using \scalebox and \colorbox) Do you really want the contents to be scaled? I don't understand what you mean by "same boxes at left and right". Do you mean rotated 90 degrees? – user4686 Oct 25 '17 at 16:19
  • I want lipsum to be inside a colored box that covers the edge of the paper. inside each box, there is a small note. So for vertical box at the left of the lipsum the text inside has to be written vertically and at the right the same. – Houda Araj Oct 25 '17 at 16:25
  • this is really not clear (to me), how many boxes? how come is the lipsum (=main text) a "small note". Best would be to enhance your question with expected result done in Word or other software. – user4686 Oct 25 '17 at 16:27
  • (hpics.li/1f84da8) The lipsum is inside box that has 1 color for head (blue) one color for foot (red), one color vertical at left (green) and one color vertical at right. – Houda Araj Oct 25 '17 at 16:49

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.