0

Lately I've become a big fan of using header rules in my works, but sometimes I feel like I could be more "stylish" if I could make slightly fancier rules. As an example of what I would like to be able to do, perhaps the rule could end in arrowheads at both ends (so something like "<–––––––––--->"), or perhaps I could have a rule with some nice emblem-like kind of thing in the middle (like the {TEX}-thing at the top of this page).

How would I go about making these things happen? I assume some kind of hard-coding of what I want goes in somewhere, but I don't know where to start.

Feel free to link to duplicates if I have missed any while searching myself. (This variant I found myself - Draw horizontal lines like open and close brackets)

  • 1
    When I see documents with fancy header I always think they do it to hide the fact that the content is crappy. Beside this: tex.stackexchange.com/questions/198947/… – Ulrike Fischer Jan 28 '16 at 11:16
  • 1
    Using package \usepackage[headsepline]{scrlayer-scrpage} you can do pretty much whatever you want. You can color the rule with \addtokomafont{headsepline}{\color{XXX}} or add whatever you want -- e.g., a tikz drawing. See @UlrikeFischer's link for a full example. I also agree that you should use it sparingly. – Joseph Jan 28 '16 at 12:24
  • Of course, I agree that a document should have meaningful content first and foremost. I don't have anything against regular rules, or against using no rules either. I just want to experiment a little and be able to, for those special occasions, be able to use something modest yet elegant for that extra little personal touch. Thank you both for your responses ; ) – A.Sh Jan 28 '16 at 15:25
3

You can do that with the \makeheadrule command, from titleps, which comes with titlesec.

Here is a attempt, with only basic tools:

\documentclass[ twoside]{article}
\usepackage[T1]{fontenc} 
\usepackage{geometry}
\usepackage[x11names]{xcolor} 
\usepackage[pagestyles]{titlesec}

\newpagestyle{fancyhead}{%
\renewcommand{\makeheadrule}{\color{LightSteelBlue3}\llap{\raisebox{-2.4ex}{\footnotesize\boldmath$>$}}\kern-0pt \makebox[\linewidth]{\rule[-2ex]{1.005\linewidth}{0.6pt}}\rlap{\raisebox{-2.4ex}{\footnotesize\boldmath$<$}}}
\sethead[\footnotesize\bfseries\thepage][][\footnotesize\itshape{\sectiontitle}]{}{\footnotesize\textbf{My Title}}{\footnotesize\bfseries\thepage}
}

\titleformat{\section}[block]{\bfseries\large}{\llap{\makebox[0.5in][l]{\thesection.}}}{0pt}{}
\pagestyle{fancyhead}


\begin{document}

\section{The First Section}

Some text text text text text text text text text text text text text text text text text text text text text text text text text.
\clearpage

\section{The Next Section}
More text in another section. More text in another section. More text in 
another section. More text in another section. 
More text in another section. More text in another section. More text in    
another section. More text in another section.   
\end{document} 

enter image description here

  • Thank you for your answer. This looks just like what I want. – A.Sh Jan 28 '16 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.