14

I want to make a border to a paragraph, so I use \framebox to do it. But I have a problem that my paragraph is so long, I can't insert a line break and my paragraph cross the frame.

\documentclass[12pt]{article}

\usepackage[utf8]{vietnam}

\begin{document}
     \framebox[0.9\textwidth]{
        \textbf{Subordinated bond} (Trái phiếu ưu tiên thấp nhất) là một trái phiếu chỉ được hoàn trả tiền sau          khi một số khoản vay khác của người phát hành đã được ưu tiên thanh toán trước. \par
        \textbf{Senior (Trái phiếu ưu tiên ở mức cao)} là những trái phiếu được đảm bảo chặt chẽ hơn, nghĩa là          được ưu tiên thanh toán tiền ở mức cao hơn các loại khác.
        }
\end{document}

enter image description here

Please help me fix problem and show me how to create a framebox whose contents are resized following that framebox.

1
  • 2
    have a look at mdframed
    – cmhughes
    Dec 19, 2012 at 19:16

2 Answers 2

18

You should wrap it in a \parbox of fixed width and box it using \fbox:

enter image description here

\documentclass[12pt]{article}
\usepackage[utf8]{vietnam}
\begin{document}
\fbox{%
  \parbox{0.9\textwidth}{%
  \textbf{Subordinated bond} (Trái phiếu ưu tiên thấp nhất) là một trái phiếu chỉ được hoàn trả tiền sau          khi một số khoản vay khác của người phát hành đã được ưu tiên thanh toán trước.
  \par
  \textbf{Senior (Trái phiếu ưu tiên ở mức cao)} là những trái phiếu được đảm bảo chặt chẽ hơn, nghĩa là          được ưu tiên thanh toán tiền ở mức cao hơn các loại khác.}%
}
\end{document}

\par inside a \framebox doesn't yield the desired result, but it works inside a \parbox.

0
6

You could use package framed

\documentclass[12pt]{article}
\usepackage[utf8]{vietnam}
\usepackage{framed}
\begin{document}

\noindent Text before text before text before text before text before
text before text before text before text before text before text before
text before text before text before text before text before text before
text before text before

\begin{framed}
  \textbf{Subordinated bond} (Trái phiếu ưu tiên thấp nhất) là một trái
  phiếu chỉ được hoàn trả tiền sau khi một số khoản vay khác của người
  phát hành đã được ưu tiên thanh toán trước.
  \par
  \textbf{Senior (Trái phiếu ưu tiên ở mức cao)} là những trái phiếu
  được đảm bảo chặt chẽ hơn, nghĩa là được ưu tiên thanh toán tiền ở mức
  cao hơn các loại khác.
\end{framed}

\noindent Text after text after text after text after text after text
after text after text after text after text after text after text after
text after text after text after text after text after text after text
after

\end{document}

using framed

You must log in to answer this question.

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