0

I'm trying to create a article template for a congress in my college. They send to me a template in word and now I'm trying to make it in latex. My first page has to be similar a this model Create custom header with LaTeX, but I need in the first page another line above the figures and strings between the figures, like this:

....................................

         text1           

|Figure1| text2 |Figure2|

         text3                   

.....................................

where the dots represent a line.

I tried to mix the code I mentioned above to another I found here and didn't work. Here is the code:

\documentclass{article}

\usepackage{lipsum}

\usepackage{ifthen}

% \usepackage[top=10mm, bottom=10mm, left=10mm, right=10mm,includehead,includefoot]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}

\lhead{}
\chead{}

\rhead{\ifthenelse{\value{page}=1}{\fancyhead[L]{%
\includegraphics[width=2cm]{example-image} \hfill 
\parbox[b]{5cm}{\centering Latex World Learning\\
very neat\\ no irritating eyes} \hfill 
\includegraphics[width=2cm]{example-image}}}{second page}}


\lfoot{From: K. Smith}
\cfoot{To: Jean A. Cory}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\begin{document}

\lipsum

\end{document}

For the rest of the article, I need just to put the name of the event aligned to the right, on the top of the page

1
  • If i understand this correct, this is about creating a title, not a header. Treating this as a title, will lead to a much simpler solution.
    – Johannes_B
    May 28, 2017 at 10:45

2 Answers 2

3

You have to load the graphicx package. Do not set \fancyhead[L]{...} inside the argument of \rhead. It defines the contents of the left header of all following pages. Additionally you have to enlarge the height of the header.

\documentclass{article}
\usepackage{graphicx}% <- added
\usepackage{lipsum}
\usepackage{ifthen}

\usepackage[top=10mm, bottom=10mm, left=10mm, right=10mm,includehead,includefoot,
headheight=46.3pt% <- added
]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[R]{%
  \ifthenelse{\value{page}=1}{%
    \includegraphics[width=2cm]{example-image} \hfill 
    \parbox[b]{5cm}{\centering Latex World Learning\\
    very neat\\
    no irritating eyes}\hfill 
    \includegraphics[width=2cm]{example-image}%
  }{second page}%
}

\fancyfoot[L]{From: K. Smith}
\fancyfoot[C]{To: Jean A. Cory}
\fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\begin{document}
\lipsum
\lipsum
\end{document}

enter image description here


If there should be a line below the header, remove \renewcommand{\headrulewidth}{0pt}. An additional line above the header can be added in \fancyhead[R]{...}, e.g.:

\documentclass{article}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{ifthen}

\usepackage[top=10mm, bottom=10mm, left=10mm, right=10mm,includehead,includefoot,
headheight=50.7pt% <- changed
]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[R]{%
  \rule{\linewidth}{\headrulewidth}\\[3pt]% <- added
  \ifthenelse{\value{page}=1}{%
    \includegraphics[width=2cm]{example-image} \hfill 
    \parbox[b]{5cm}{\centering Latex World Learning\\
    very neat\\
    no irritating eyes}\hfill 
    \includegraphics[width=2cm]{example-image}%
  }{second page}%
}

\fancyfoot[L]{From: K. Smith}
\fancyfoot[C]{To: Jean A. Cory}
\fancyfoot[R]{\thepage}
\renewcommand{\footrulewidth}{0pt}

\begin{document}
\lipsum
\lipsum
\end{document}

enter image description here

2
  • Thank you @esdd. Now I understood, but I have one more doubt. How can I set another headrule? With the command \renewcommand{\headrulewidth}{0pt} I can just put a line below my header and I need to put another line, above it. Thanks again May 26, 2017 at 10:31
  • See my updated answer.
    – esdd
    May 28, 2017 at 10:28
1

You can declare other fancypagestyles by using:

\fancypagestyle{otherfancy}{\fancyhf{}
\chead{<smt>}
\cfoot{<smt>}%....
}

and use command \thispagestyle{otherfancy} to active it in only this page.

You must log in to answer this question.

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