LyXHeader, Lyx

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
lynan
Posts: 2
Joined: Tue Mar 22, 2011 9:30 pm

Header, Lyx

Post by lynan »

Hi everybody,

It is the first time that I write here, so sorry for ignorance.
I am writing my tesis in lyx and i do not control too much lyx.

My question is:
I would like to do an special header.
  • Odd pages should have two small pictures, one is the logotype of my university and the other is the logotype of my department.Each one in one side.
    Even pages should have the title of the chapter and my name.
    The number of the pages will be at the botton of the page.
I am writing my tesis with the format book and I have default values for the header and foot.I only would like to change the header and the foot, not the other default values.
I know I should add latex code to the docomento to achive my aim but I have tried to write code of differents web pages and i can not achieve.

How can I do that?

Many Thanks for your patience.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Header, Lyx

Post by meho_r »

Try putting this code into your preamble (Document > Settings > LaTeX Preamble):

Code: Select all

\usepackage[demo]{graphicx}% remove 'demo' option, it's only for testing purposes

\usepackage{fancyhdr}

\fancyhf{}

\fancyhead[LE]{Lynan \textbullet\ \leftmark}% \leftmark will print chapter name; change other parts as you see fit

\fancyhead[RO]{%
\includegraphics[height=1em]{logo_dep}% replace 'logo_dep' with your department logo name
\hfill%
\includegraphics[height=1em]{logo_uni}% replace 'logo_uni' with your department logo name
}

\fancyfoot[C]{\thepage}

\pagestyle{fancy}
For more details about headers and footer take a look at fancyhdr package documentation.
lynan
Posts: 2
Joined: Tue Mar 22, 2011 9:30 pm

Header, Lyx

Post by lynan »

First of all, many thanks.
I have written your code in the preamble and works ok, however it is not showing the images.
  • What do I have to write in the place of "logo_dep"? I mean, the complete path of the image or only the name?
    C:\...\mypicture.png or only mypicture.png?
    I have tried with both but any of them have work. Maybe it is a problem with the format .png? Do I have to do something more?
Thanks
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Header, Lyx

Post by meho_r »

Usually, it is enough to have pictures in the same folder as the main .lyx file so that you can use only names, without full paths and without extension. However, I'm not sure if that applies to Windows. All I can say is that if you have spaces in your path, pictures probably won't show up. So, if your pictues are somewhere C:\Documents and Settings\lynan\My Pictures, this won't work because of spaces. Try putting them somewhere else, e.g.: C:\LyX\Pictures. PNG images should work fine.
Post Reply