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 need to reproduce the following header format:

enter image description here

Please help; I'm a completely starter at LaTeX or TeX. I work with LyX and this is included in the document's preamble:

\usepackage{fancyhdr}
\usepackage{multicol}
\usepackage{graphics}
\def\headrule{{%
  \if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
  \hrule\@height\headrulewidth\@width\headwidth\vskip2pt%
  \hrule\@height\headrulewidth\@width\headwidth\vskip-\headrulewidth\vskip-4pt
}}
\pagestyle{fancy}
\fancypagestyle{plain}%{%
\fancyhf{} % clear all header and footer fields
\renewcommand{\headrulewidth}{0.4pt}
\fancyhead{\resizebox{2in}{!}{\includegraphics{logo.png}}}
\vskip10pt
\lhead{\bfseries Reporte de Desarrollo}
\rhead{\bfseries DES-001}
\lfoot{Por: A. Perez}
\cfoot{\thepage /2}
\rfoot{Departamento de Diseño}
\renewcommand{\footrulewidth}{0.4pt}

Thanks Samuel Albert for your Help.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

Here is the solution I propose. I added use of package lastpage to have the last page number automated. I changed the package graphics to graphicx to have the functionnalities I use to dimention your logo. This code replaces what you have given.

\usepackage{etoolbox}%
\usepackage{fancyhdr}%
\usepackage{multicol}%
\usepackage{graphicx}%
\usepackage{lastpage}%
%
\def\MyLogo{MyLogo.ext}%
\newlength\logoHeight%
\setlength{\logoHeight}{50pt}%
\def\textheadLeft {ss Technical Document}%
\def\textheadRight{TD-1}%
\def\textfootLeft {Por: A. Perez}%
\def\textfootRight{Departamento de Diseño}%
%
\makeatletter%
\headheight = 80pt%
\fancypagestyle{plain}{%
  \fancyhf{}%
  \fancyhead[C]{%
    \fboxsep = 0pt
    \hbox to \headwidth%
    {%
      \parindent = 0pt%
      \hsize = \headwidth%
      \hfil%
      \vbox to \logoHeight%
      {%
        \vfil% 
        \includegraphics[keepaspectratio,height=\logoHeight,width=\headwidth]{\MyLogo}%
        \vfil%
      }%
      \hfil%
    }%
  }%
  \lfoot{\textfootLeft}%
  \cfoot{\thepage / \pageref{LastPage}}%
  \rfoot{\textfootRight}%
  \renewcommand{\footrulewidth}{0.4pt}%
  \renewcommand{\headrulewidth}{10pt}%
}%
%
\def\headrule{%
  \hrule\@height\footrulewidth\@width\headwidth\vskip2pt%
  \textbf{\textheadLeft}\hfill\textbf{\textheadRight}%
  \vskip2pt\hrule\@height\footrulewidth\@width\headwidth%
}%
\makeatother%
%
\pagestyle{plain}%

EDIT:

Since you're new to latex, I decided to make it a little easier. You now sould have only to modify the first few lines after package loading

Samuel, I used your code, but Lyx seems to fall in some sort of loop. I changed your MyLogo.ext to logo.png, is that the right thing to do?

Mylogo.ext should indeed be replaced by a path to your logo :

  • It can be an absolute path starting from the root of your system (c:/.../logo.png).
  • It should however preferably be a relative path originating from the folder where your .texfile belongs to, so that if you move all of this, it will still compile.

For exemple, if the image you want to use is named logo.png and is in the subfolder images/ of the folder where your .tex file is located, you should have the line

\def\MyLogo{images/logo.png}%

Also note that before all of this, you should have declared the document class you use. For example, in the file I used to try this, I have used a report document class.

\documentclass[10pt,a4paper,titlepage,oneside,onecolumn]{report}

Finally, after this header, you should have your \begin{document} followed by the document itself. For example in my test document

\begin{document}
test
\end{document}

To conclude, I am not able to test this under Lyx since I use a combination of Miktex 2.9 and Texmaker, but I am sure someone who uses it will be kind enough to confirm whether it works or not.

Maybe one very last thing to lote is that I use Lualatex. Since there is some non-strictly ASCII characters in the exemple, it could have an incidence (even though I don't really think so). Maybe try to remove the ñ in a first step to make sure it's not the cause of any problem.

Final Solution

After checking everything as sugested by Samuel Albert, I ended trimming the code due to replicated info. The ñ character wasn´t relevant due to LyX configuration, but other parts of the code were. The following code worked:

\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{multicol}
\usepackage{lastpage}%
\usepackage{graphicx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecommand{\tabularnewline}{\\}
\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\MyLogo{logo.png}%
\newlength\logoHeight%
\setlength{\logoHeight}{50pt}%
\def\textheadLeft {Reporte de Desarrollo}%
\def\textheadRight{DES-001}%
\def\textfootLeft {Por: A. Perez}%
\def\textfootRight{Departamento de Diseño}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\headheight = 80pt%
\fancypagestyle{plain}{%
  \fancyhf{}%
  \chead{%
    \fboxsep = 0pt
    \hbox to \headwidth%
    {%
      \parindent = 0pt%
      \hsize = \headwidth%
      \hfil%
      \vbox to \logoHeight%
      {%
        \vfil% 
        \includegraphics[keepaspectratio,height=\logoHeight,width=\headwidth]{\MyLogo}%
        \vfil%
      }%
      \hfil%
    }%
  }%
  \lfoot{\textfootLeft}%
  \cfoot{\thepage / \pageref{LastPage}}%
  \rfoot{\textfootRight}%
  \renewcommand{\footrulewidth}{0.4pt}%
  \renewcommand{\headrulewidth}{10pt}%
}%
%
\def\headrule{%
  \hrule\@height\footrulewidth\@width\headwidth\vskip2pt%
  \textbf{\textheadLeft}\hfill\textbf{\textheadRight}%
  \vskip2pt\hrule\@height\footrulewidth\@width\headwidth%
}%
%
\pagestyle{plain}%
share|improve this answer
    
Samuel, I did some corrections to your code for it to work. It seems that Lyx can create TeX files from it's files and i created such one, then checked for replicated declarations and that's how I was able to make it work, i'll next post the solution, how can i Credit you for you enormous help? –  AperezC Aug 16 '12 at 21:59
    
@AperezC At the top of and to the left of the answer the Samuel gave, there is an arrow pointing up and an arrow pointing down with a number between them. To indicate that Samuel gave a good answer, you can click on the arrow that points up (an "upvote"). Below these there will be a checkmark, by clicking the checkmark you will indicate that Samuel has answered your question. Both of those actions, upvoting and accepting, will add to Samuels reputation and give him credit for his effort. –  Scott H. Aug 16 '12 at 23:13
    
@AperezC Thanks for your corrections. As Scott said, the way in here to reward people for answering is upvoting and marking the answer as being correct. This is also a way to indicate for people that would want to answer a similar question that this was the correct answer to your problem and that it was a quality answer. You should also maybe remove the answer you posted when you could not comment, as it is not relevant anymore. –  Samuel Albert Aug 16 '12 at 23:19
    
Sorry to bother you again @AperezC , but could you please check the tickmark under the voting arrows (if you don't see where it is, see for example here link. It will mark it as the accepted question and credit me for it in the process. Thanks in advance. –  Samuel Albert Aug 17 '12 at 21:09
    
Done Samuel. Awful days at work. I'll be posting one issue found for this solution, image is a little off-center to the right; if it can be solved, magnificent. –  AperezC Aug 17 '12 at 23:38
show 1 more comment

Your Answer

 
discard

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.