0
\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
\begin{center}
{\Large 
-----------------------------
Education 
----------------------------}
\end{center}
\end{document}

I'm working on my resume, and I would like to create a section title called Education where the lines to the left and right of the text extend to the margins. Currently I'm manually typing out all the individual "-"s, which is very inefficient. Also, the actual output is nowhere near perfect. As you can see below, the last "-" is a bit off from the rest.

enter image description here

0

There are many ways to place horizontal lines or rules around a title. Here are some examples taken from here and here.

documentclass{article}
\usepackage[utf8]{inputenc}

% First command
\makeatletter
\def\myrulefill{\leavevmode\leaders\hrule height .7ex width 1ex depth -0.6ex\hfill\kern\z@}
\makeatother

% Second command
\newcommand{\textbetweenrules}[2][.4pt]{%
  \par\vspace{\topsep}
  \noindent\makebox[\textwidth]{%
    \sbox0{#2}%
    \dimen0=.5\dimexpr\ht0+#1\relax
    \dimen2=-.5\dimexpr\ht0-#1\relax
    \leaders\hrule height \dimen0 depth \dimen2\hfill
    ~#2
    \leaders\hrule height \dimen0 depth \dimen2\hfill
  }\par\nopagebreak\vspace{\topsep}
}

\begin{document}
\Large
\noindent\hrulefill ~Education~\hrulefill
\medskip
\noindent\myrulefill ~Education~\myrulefill\par
\medskip
\textbetweenrules{Education}
\end{document}

The first example is with an ordinary \hrule, which lies at the bottom of the row. The second and third use some predefined commandsas specified.

enter image description here In the command \textbetweenrules{Education} you can modify the rule widh by putting the parameter between brackets. For example \textbetweenrules[3pt]{Education}

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.