I have a header, prepared using fancyhdr
. I would like the first row of the left header to be right-aligned with the second row of the left header.
In the following MWE I would like "My City" to be right aligned with "University of somewhere" (so that "City" is just above "somewhere"). How do I achieve that?
\documentclass{article}
\usepackage{fancyhdr}
\usepackage{fancyheadings}
\pagestyle{fancy}
\rhead{\textsc{Tutorial\\The periodic table}}
\lhead{\textsc{My city\\University of somewhere}}
\cfoot{\thepage}
\begin{document}
hello
\end{document}
Best Answer
You can box the contents of the widest element and use this to width-adjust the shorter one:
\myheadbox
contains the "University of somewhere" (in the appropriate font,\scshape
). Then, "My city" isr
ight-aligned in a\makebox
of width\wd\myheadbox
(width of\myheadbox
).