I want to have a rule in the middle of a line which starts at end of a section and goes all the way to the right margin of a page.
I have seen several posts with solutions and the best one I found is by using this:
\documentclass{article}
\usepackage{linegoal}
\begin{document}
\newcommand{\centerrule}{\leavevmode\rule[.2em]{\linegoal}{.1em}
\section{section \centerrule}
\end{document}
This works fine, but I would like to apply the \centerrule
with titlesec
package. Which doesn't work. No matter how I add it, the rule is either in front of the \section
or under it. Is there any way to achieve this?