This question already has an answer here:

How to frame an environment like \minipage and others in a frame box.

Note: I tried \fbox and never worked, I always get errors This is my code


[2018-05-25 19:21:48 EDT] iverilog '-Wall' design.sv testbench.sv  && unbuffer vvp a.out  
a=  2, b=  5, outsum=  7, true_sum=  7, cout=0
a=  2, b= 34, outsum= 36, true_sum= 36, cout=0
a=  2, b= 63, outsum= 65, true_sum= 65, cout=0
a=  2, b= 92, outsum= 94, true_sum= 94, cout=0
a=  2, b=121, outsum=123, true_sum=123, cout=0
a=  2, b=150, outsum=152, true_sum=152, cout=0
a=  9, b=  5, outsum= 14, true_sum= 14, cout=0
a=  9, b= 34, outsum= 43, true_sum= 43, cout=0
a=  9, b= 63, outsum= 72, true_sum= 72, cout=0
a=  9, b= 92, outsum=101, true_sum=101, cout=0    
a=  9, b=121, outsum=130, true_sum=130, cout=0
a=  9, b=150, outsum=159, true_sum=159, cout=0
a= 16, b=  5, outsum= 21, true_sum= 21, cout=0
a= 16, b= 34, outsum= 50, true_sum= 50, cout=0
a= 16, b= 63, outsum= 79, true_sum= 79, cout=0
a= 16, b= 92, outsum=108, true_sum=108, cout=0
a= 16, b=121, outsum=137, true_sum=137, cout=0
a= 16, b=150, outsum=166, true_sum=166, cout=0


and this the errors I got

Paragraph ended before \@xverbatim was complete. \end{minipage}}

Extra }, or forgotten \endgroup. \end{minipage}}

Improper \prevdepth. \chapter

Missing \endgroup inserted. \chapter

Missing } inserted. \chapter

marked as duplicate by David Carlisle, Mico, Sebastiano, Stefan Pinnow, TeXnician May 26 '18 at 10:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    you don't say how you used \fbox but \fbox{\begin{minipage}{2cm}zzzz\end{minipage}} frames a minipage. So it is not clear what problem your question is asking about. – David Carlisle May 26 '18 at 0:31
  • I tried \fbox{\begin{minipage}{\linewidth}\begin{verbatim} couple lines of text \end{verbatim}\end{minipage}} and I got errors and never works, I searched a lot till I found framed package, and that solved my problem – Mohammad Hizzani May 26 '18 at 1:31
  • A statement such as "I got errors" is not very descriptive. Which errors did you get? Be as specific as possible. – Mico May 26 '18 at 2:23
  • \fbox is wider than what it contains (by 2\fboxsep+2\fboxrule), so if the contents are already \linewidth, then it is too wide for the page. – John Kormylo May 26 '18 at 3:36

I found a package framed you can easily use to frame any environment

any thing to be framed
  • 1
    Yes, and furthermore it can break across pages, which minipage cannot do. – Bernard May 26 '18 at 0:09
  • 2
    You may want to instead look at the tcolorbox package. – Peter Grill May 26 '18 at 1:10

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