1

Adding a horizontal rule inside the framed environment, the line only spans the text area.
But i want the line to span the complete box width.

How do i do that?

Current Code:

\begin{framed}
Foo.\\
\rule{1\textwidth}{1pt}\\
Bar\\
\rule{1\textwidth}{1pt}\\
Baz
\end{framed}

Current result:

Result

Expectation:

Expectation

0

I found a solution that works for me. It's not very generic though.

To make this work seamlessly in LyX (which outputs \rule for horizontal lines), I decided to re-define the \rule command to move the line 9pt to the left (which seems to be the inner padding of the framed environment) and make it 18pt longer:

\newlength{\framedline}
\setlength{\framedline}{\textwidth plus 18pt}
\let\oldrule\rule
\renewcommand{\rule}[2]{
   \hspace*{-9pt}\oldrule{\framedline}{0.4pt}\newline
}

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.