Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to place a long bold \hrule-type line under the \section to make it more distinctive. How can I do that?

share|improve this question
    
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It is considered a lot better to put in some code that will compile, as it makes it a lot easier for us to copy it into our text editor and work with it, and see exactly what it is you are trying to do. –  henrique Nov 24 '12 at 15:39

1 Answer 1

up vote 21 down vote accepted

You can use the titlesec package; the optional argument for \titlerule allows you to control the rule "thickness":

\documentclass{article}
\usepackage{titlesec}

\titleformat{\section}
  {\normalfont\Large\bfseries}{\thesection}{1em}{}[{\titlerule[0.8pt]}]

\begin{document}

\section{Test Section}

\end{document}

enter image description here

share|improve this answer
    
Thanks a lot! It works! –  lhhNJU Nov 25 '12 at 6:36
    
And for the width? Because default is \textwidth... –  FormlessCloud May 3 '13 at 20:13
    
@FormlessCloud can you please expand your question a little? I don't understand what you mean. Do you want the line only to cover the title and not the whole text width? –  Gonzalo Medina May 3 '13 at 20:23
    
Sure, for example, if I would a \titlerule that have the width of for example .5\textwidth how can I do this? Because if I type only \titlerule that command give me automatically a rule that fit the entire width of my page. In sinthesys I would to adjust the length (or I can call it width, how you prefer) of my line. –  FormlessCloud May 3 '13 at 20:46
1  
@FormlessCloud Ah, I see. In that case, instead of [{\titlerule[0.8pt]}] you can use something like [\vskip-10pt{\makebox[\linewidth][l]{\rule{0.5\textwidth}{0.8pt}}}] (adjusting the vertical skip, if necessary). Changing the settings for the \makebox you can also obtain lines wider than the \textwidth. –  Gonzalo Medina May 3 '13 at 20:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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