LaTeX forum ⇒ GeneralHeader and footer Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Header and footer

Postby Jchen066 » Sun Sep 16, 2018 4:08 pm

Tried to use pictures for header and footer. please see below code used and the output:

The header picture doesn't covere the entire header area. Can I change the header height to match the picture or other way around.

  1. \documentclass[12pt,english]{article}
  2.  
  3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  4. % PACKAGES
  5. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  6.  
  7. % GEOMETRY - Provide the geometry settings of document
  8. \usepackage{geometry}
  9. \geometry{
  10. left = 28mm,
  11. right = 28mm,
  12. top = 50mm,
  13. bottom = 28mm,
  14. bindingoffset = 0mm,
  15. headheight = 103pt,
  16. headsep = 15mm,
  17. footskip = 0mm
  18. }
  19.  
  20. \usepackage{lmodern}
  21.  
  22. % AMSFONTS - Allows for \mathbb fonts
  23. \usepackage{amsfonts}
  24.  
  25. % MARGINNOTE - Allows for additive calculations
  26. \usepackage{marginnote,calc,kantlipsum}
  27.  
  28. % TIKS & PGFPLOTS - Allows the creation of graphics
  29. \usepackage{tikz}
  30. \usepackage{pgfplots}
  31.  
  32. % PARSKIP - Provides instant formatting to indents on paragraphs. Having this package will remove indentation.
  33. \usepackage{parskip}
  34.  
  35. % LIPSUM - For debugging purposes; provides text in Latin
  36. \usepackage{lipsum}
  37.  
  38. % ESO-PIC - Allows floating text (and perhaps pictures) to be placed in either the foreground or backgrounds
  39. \usepackage[pscoord]{eso-pic}
  40.  
  41. % COLOR - Allows user to user colours on text
  42. \usepackage{color}
  43. \usepackage{xcolor}
  44.  
  45. % TCOLORBOX - Allows for coloured boxes
  46. \usepackage{tcolorbox}
  47.  
  48. % VLecture Colours
  49.  
  50. \definecolor{vlecture}{RGB}{63,163,175}
  51. \definecolor{vlecture2}{RGB}{184,189,38}
  52.  
  53. % TITLESEC - Stylign on default section headings
  54.  
  55. \usepackage{titlesec}
  56.  
  57. % RELSIVE - Increase the size of equations in the math environment
  58.  
  59. \usepackage{relsize}
  60.  
  61. % CONTOUR - Contours on titles
  62.  
  63. \usepackage{contour}
  64.  
  65. \titleformat{\section}
  66. {\color{vlecture}\normalfont\Large\bfseries}
  67. {\color{vlecture}\thesection}{1em}{}
  68.  
  69. \titleformat{\subsection}
  70. {\color{vlecture2}\normalfont\large\bfseries}
  71. {\color{vlecture2}\thesubsection}{1em}{}
  72.  
  73. % MULTICOL - For multiple columns
  74.  
  75. \usepackage{multicol}
  76.  
  77. % DASHRULE
  78.  
  79. \usepackage{arydshln}
  80.  
  81. \setlength{\dashlinedash}{0.2pt}
  82. \setlength{\dashlinegap}{4.5pt}
  83. \setlength{\arrayrulewidth}{0.2pt}
  84.  
  85. % FANCYHDR - For additional options on headers and footers
  86. \usepackage{fancyhdr}
  87. \usepackage{array}
  88.  
  89. \newlength{\myoddoffset}
  90. \setlength{\myoddoffset}{\marginparwidth + \marginparsep}
  91.  
  92. \pagestyle{fancy}
  93. \fancyheadoffset[leh,roh]{\myoddoffset}
  94. \fancyheadoffset[loh,reh]{\myoddoffset}
  95.  
  96. \fancyheadoffset[lf,rf]{\myoddoffset + 25pt}
  97. %\fancyheadoffset[lof,ref]{\myoddoffset + 25pt}
  98.  
  99. %\lhead{\Large \bfseries\begin{tabular}{c}Year 11 \\ Mathematics \\ Extension 1\end{tabular}}
  100.  
  101. \fancyhead[L]{
  102. \large \bfseries \sffamily
  103. \begin{tabular}{c}
  104. Year 11 \\ Mathematics \\ Extension 1
  105. \end{tabular}
  106. }
  107.  
  108. \fancyhead[C]{
  109. \begin{tabular}{c}
  110. \includegraphics[height=2.9cm, width=22cm]{C:/Users/jiech/Documents/Tuition/pictures/pictures/header.png}
  111. \end{tabular}
  112. }
  113.  
  114. \fancyhead[R]{
  115. \large \bfseries
  116. Volume (i)
  117. }
  118.  
  119. \fancyfoot[L]{
  120. \includegraphics[height=2.8cm, width=22cm]{C:/Users/jiech/Documents/Tuition/pictures/pictures/footer.png}
  121. }
  122.  
  123. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  124. % COMMANDS
  125. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132. \begin{document}
  133.  
  134. % Create title page
  135.  
  136.  
  137.  
  138. \section{Introduction}
  139.  
  140.  
  141.  
  142. \end{document}
Attachments
head 2.PNG
head 2.PNG (32.24 KiB) Viewed 742 times
Last edited by Stefan Kottwitz on Sun Sep 16, 2018 4:37 pm, edited 1 time in total.
Reason: code marked

rais
Posts: 173
Joined: Sun Nov 16, 2014 8:51 pm

Postby rais » Mon Sep 17, 2018 2:57 am

Hi there,
you've put the header logo into an additional tabular environment.
There's nothing wrong with that as such, but according to the column declaration---the {c}---you want \tabcolsep space left (and right) of this column.
Try {@{}c@{}} instead (the @{} cuts off the additional space, here on both sides of the c column).

KR
Rainer

Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Postby Jchen066 » Mon Sep 17, 2018 4:07 pm

rais wrote:Hi there,
you've put the header logo into an additional tabular environment.
There's nothing wrong with that as such, but according to the column declaration---the {c}---you want \tabcolsep space left (and right) of this column.
Try {@{}c@{}} instead (the @{} cuts off the additional space, here on both sides of the c column).

KR
Rainer


Thanks Rainer. Indeed, it removed the space from both left and right side.

Is there a way to align the logo (the blue golden line) to the header line (dark line)

rais
Posts: 173
Joined: Sun Nov 16, 2014 8:51 pm

Postby rais » Tue Sep 18, 2018 6:32 am

Well, you could put the image in a \raisebox and let it tell LaTeX, its contents has neither height nor depth.
However, your header image will then most likely overwrite the stuff from the left side; looks like you've already considered that and used a transparent background (otherwise, `year 11' wouldn't have been visible). So for those using a header file without transparency, I'd put the header image into a \makebox in the left header part already, where I can tell LaTeX to overwrite this box:
  1. \fancyhead[L]{%
  2. \makebox[0pt][l]{%
  3. \raisebox{-8mm}[0pt][0pt]{%
  4. \includegraphics[height=3.5cm, width=22cm]{header}%
  5. }%
  6. }%
  7. \large \bfseries \sffamily
  8. \begin{tabular}{c}
  9. Year 11 \\ Mathematics \\ Extension 1
  10. \end{tabular}%
  11. }

Or, you could use the eso-pic package for putting the header image in the background at top of the page (you're already loading it).

KR
Rainer


Return to “General”

Who is online

Users browsing this forum: No registered users and 10 guests