# Fancy style section titles for a resume

I'm wondering if exists a way in LaTeX to create a section title style (for a resume) like this:

--------------------Education-------------------


There's for sure a wrong way, simply adding - sign but requires to write manually all characters... in that case why even using LaTeX? :)

What about \hline \line or something similar?

-
Some time ago I gave an answer to this, allowing for multiple line titles, using the titlesec package: tex.stackexchange.com/a/57258/3954. – Gonzalo Medina Jun 22 '12 at 2:10

A nice exercise in low level TeX commands. :)

\documentclass{article}

\usepackage{lipsum} % mock text

%%% this is the important code
\newcommand{\myresumesection}[1]{%
\noindent\myresumetitle{#1}\par
}
\newcommand{\myresumetitle}[1]{%
\makebox[\textwidth][s]{\large\bfseries
\leaders\hrule height \dimexpr .5ex + 0.2pt\relax
depth -\dimexpr .5ex - 0.2pt\relax\hfill
\ #1\
\leaders\hrule height \dimexpr .5ex + 0.2pt\relax
depth -\dimexpr .5ex - 0.2pt\relax\hfill
}%
}
%%% end of the important code

\begin{document}

\lipsum[2]

\myresumesection{Education}

\lipsum[1]

\end{document}


The mysterious instructions are:

1. Make sure we are at the start of a paragraph
3. Print the title in a box
4. End the line

Now the more mysterious instructions

1. The box is as wide as the lines
2. Its content must be stretched to fill, in \large size and boldface type
3. Print a rule at mid height of the letters without ascenders or descenders (1ex is precisely the height of an "x"); the rule is actually slightly higher, and its depth is negative, so the net effect is a rule 0.4pt thick
4. Print the title surrounded by spaces
5. Print another rule to fill

In order to avoid a page break just after the title, change the first definition into

\makeatletter
\newcommand{\myresumesection}[1]{%
\noindent\myresumetitle{#1}\par
}
\makeatother


(\@afterheading is the magic trick that LaTeX uses for section titles)

-
Thanks! I'll try both yours and Werner solution – Teo Jun 22 '12 at 8:33

The xhfill package provides these extensible rules. And, since this is for a resume, it would most likely be overkill to use \sections. Here's a minimal example showing the use of xhfill via \mytitle[<thickness>]{<title>}:

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{xhfill}% http://ctan.org/pkg/xhfill
\newcommand*{\mytitle}[2][.4pt]{%
\bigskip\noindent\leavevmode\xrfill{#1}~{\bfseries\large#2}~\xrfill{#1}\mbox{}\nobreak\par
}
\begin{document}
\mytitle{Education}
\lipsum[1]
\mytitle{Professional background}
\lipsum[2]
\end{document}​


Default for <thickness> is .4pt.

-
Thanks! I'll definitely try both solutions! – Teo Jun 22 '12 at 8:33