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 am trying to put a horizontal line between homework problems, like this:

\begin{description}
%stuff . . .
\rule{\linewidth}{0.4mm}
\item[Exercise 1]
%stuff
\rule{\linewidth}{0.4mm}
\end{description}

If I knew how to get this to display on this website, you would see that the line begins over the second 'e' of 'Exercise', and looks off, as one would like the line to be exactly aligned over the capital 'E'. Does anyone know how to do this?

share|improve this question
    
Try \hspace*{\dimexpr-\labelwidth-\leftmargin\relax}\rule{\linewidth}{0.4mm} –  Peter Grill Mar 9 '12 at 0:47
    
That translates the whole line left, leaving the right side of the text "un-underlined". –  Nick Thompson Mar 9 '12 at 1:00
    
Of course, I forgot to adjust the right hand side: \hspace*{\dimexpr-\labelwidth-\leftmargin\relax}\rule{\dimexpr\linewidth+\label‌​width+\leftmargin\relax}{0.4mm}. But solution below seems to work just fine. –  Peter Grill Mar 9 '12 at 1:05
    
Ah! That works! Thanks. –  Nick Thompson Mar 9 '12 at 1:28
add comment

1 Answer

up vote 5 down vote accepted

This is a bit of a kludge, but it seems to work.

\documentclass{article}
\usepackage{showframe} % as per PeterGrill's suggestion
\newcommand{\fullwidthline}[1]{\hspace{\itemindent}\rule{\textwidth}{#1}}

\begin{document}
\begin{description}
   \item[Exercise 1] ...

   \fullwidthline{0.4mm}
   \item[Exercise 2] ...

   \fullwidthline{0.4mm}
    \item[Exercise 3] ...
\end{description}
\end{document}
share|improve this answer
    
Thank you very much! That worked perfectly. (I would accept this answer but I don't have enough rep!) –  Nick Thompson Mar 9 '12 at 0:49
1  
Excellent!!. If you add \usepackage{showframe} you get a nice image to show that the line is indeed the full width. –  Peter Grill Mar 9 '12 at 1:06
    
neat! Didn't know about that package :) –  dbaupp Mar 9 '12 at 1:09
add comment

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.