I am trying to define an environment which requires a frame line as wide as \textwidth


I am not sure how I could constrain the width of the line?


1 Answer 1


One can modify this solution to a related question as follows:






  Test the verbatim.  
  Here is some more.



Sample output

\hrule on its own will produce a line of length \textwidth, however, it only adds a minimal amount of vertical space. This is the reason for putting in the \vskip's. You may well want to adjust the size of these spaces (or use \smallbreak, etc.) and you may also want to add some negative \vskip amount just after the first rule and just before the last. E.g. the following gives spacing closer to that obtained from \begin{Verbatim}[frame=lines]:


If you need the rules to be of different thickness you can write something like \hrule height 2pt instead.

You must log in to answer this question.

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