0

I am creating a C.V. and I would like to have a section of the C.V. (like "publications") have a long horizontal line following it to the end of the right page margin.

I have gotten this to work with some really messy coding:

\textbf{Publications~}\noindent {\color{black} \rule{16cm}{0.3mm}}

But this is really tedious adjusting the \rule margin to fit each section. Why couldn't something like this work, to automatically fill the line for the page width? -

\textbf{Publications~}\noindent {\color{black} \rule{\hfill}{0.3mm}}

I have checked out a few other help files, but haven't found anything. This is my first time asking a question, thanks for any feedback. [Other Information:]

\documentclass[12pt]{article}

% Configure page margins with geometry
\usepackage[top = .8cm, left = 1.4cm, right = 1.4cm, bottom = 1.8cm]{geometry}

% Colors Used:
\usepackage{color}
\usepackage[dvipsnames]{xcolor}
\definecolor{gray}{HTML}{5D5D5D}

Edit:

Thank you @Bernard, the solution is simple:

\textbf{Publications~}\noindent \hrulefill
7
  • 2
    Welcome to TeX SX! Simply use \hrulefill.
    – Bernard
    Feb 14, 2018 at 21:34
  • Thanks! Is there any package I need to use for that? When I tried \hrulefill (as well as a few others) it gives me both a "Missing number, treated as zero" and "Illegal Unit of Measure" errors. To be clear, I wouldn't like the actual section title ("publications") to be underlined, just the space following it.
    – Kyle Davis
    Feb 14, 2018 at 21:37
  • Wait I've found it, thanks @Bernard I just took out the whole rule command I was working with and swapped it out for the \hrulefill. Thanks again!
    – Kyle Davis
    Feb 14, 2018 at 21:41
  • @Bernard Would you like to add an answer?
    – CarLaTeX
    Feb 16, 2018 at 15:57
  • @CarLaTeX: Il suo desiderio è un ordine :o)
    – Bernard
    Feb 16, 2018 at 17:03

1 Answer 1

1

It's enough to use \hrulefill. However in this context, I'd define a special formatting of (unnumbered) \sections with titlesec, which has the \titlerule command for this:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[dvipsnames, svgnames]{xcolor}
\usepackage[explicit]{titlesec}
\titleformat{\section}{\large\bfseries}{}{0pt}{\textcolor{SteelBlue!80}{#1}\enspace \color{LightSteelBlue!50}\titlerule[1ex]}[]

\begin{document}

\section{Publications}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .