TransWikia.com

How to add my name on every page corner in Lyx?

TeX - LaTeX Asked by user42356 on December 7, 2020

My teacher has asked me to add my name on every page of my report. Is there a nice way of doing this so my name appears in a subtle way?

2 Answers

For adding your name to the header/footer, LyX provides "fancy" heading via the fancyhdr package. First, activate these style headings (Document > Settings... > Page Layout > Heading Style):

enter image description here

Now add the following code to your LaTeX Preamble (also under Document > Settings...):

fancyhf{}               % Clear fancy header/footer
fancyfoot[L]{My name}   % My name in Left footer
fancyfoot[R]{thepage}  % Page number in Right footer
makeatletter
letps@plainps@fancy   % Plain page style = fancy page style
makeatother

The first three lines set clears the header/footer, and sets the L and R footer respectively. The last three lines replaces the plain page style (typically associated with title pages and the like) to be equivalent to the fancy page style. This might not be necessary in your case.

Correct answer by Werner on December 7, 2020

Here is a solution that doesn't require headers or footers. It exploits the command AddToShipoutPicture of the eso-pic package.

I'm assuming that you want your name in the upper left corner, but it can be adjusted to be everywhere in the page.

Code:

documentclass{article}
usepackage{eso-pic}
usepackage{blindtext} % just for the example

AddToShipoutPicture{%
  AtPageUpperLeft{%
    hspace*{20pt}makebox(200,-20)[lt]{%
      footnotesize%
      textbf{user42356}%
}}}

begin{document}

blinddocument % just for the example

end{document} 

Output:

enter image description here

P.S. To add this stuff in the preamble in LyX, go to Document --> Settings --> LaTeX Preamble and insert the required lines, i.e.

usepackage{eso-pic}

AddToShipoutPicture{%
  AtPageUpperLeft{%
    hspace*{20pt}makebox(200,-20)[lt]{%
      footnotesize%
      textbf{user42356}%
}}}

Answered by karlkoeller on December 7, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP