1

Is it possible to line-break a framed text box in LaTeX? If so, is it necessary to use some package to do so, and what is the name of that package?

EDIT: For greater clarity, let me give an example. Suppose I am typing a line of text and I put a long word in a framed box at the end of this line. Because by default LaTeX will not line-break such a framed box it will stick out of the right margin of text. My question concerns the possibility of line-breaking this framed text box over to the left side of the next line. In this way, both the text and the frame itself would be line-breaked from the right side of the given line to the left side of the next line.

  • 2
    No, you do not need a package, e.g. \documentclass{article} \begin{document} \fbox{\begin{minipage}{3cm} This is a rather long sentence with no meaning. \end{minipage}} \end{document} works, but you may enjoy the nice options tcolorbox offers. –  Nov 04 '19 at 03:58
  • Perhaps I'm not being clear: I want the frame itself to break over a line. – The Riddler Nov 04 '19 at 04:00
  • Sorry, can you try to rephrase? Or are you looking for https://tex.stackexchange.com/q/411339 ? –  Nov 04 '19 at 04:01
  • I think that's what I'm looking for, although it looks awfully complicated :( – The Riddler Nov 04 '19 at 04:08
  • Can you post MWE? and also provide more clear picture on your requirement.. – MadyYuvi Nov 04 '19 at 05:11

2 Answers2

4

I know only a trick, which works only manually:

\documentclass[12pt,a5paper]{article}
\usepackage{fbox}
\begin{document}

We look inside the alternate reality of the president’s 
Twitter account, where he absorbs and amplifies a 
noxious stream of disinformation.

We look inside the alternate reality of the \fbox[lbt]{presi-} \fbox[rbt]{dent’s} 
Twitter account, where he absorbs and amplifies a 
noxious stream of disinformation.

\end{document}

enter image description here

user187802
  • 16,850
0

Easy way to create a framed box is:

\usepackage{framed}
\begin{framed}
blah blah...
\end{framed}

This allows line break, page break etc.

Framed boxes with many custom styles then tcolorbox and tikz packages are preferable.

mdframed package also one of nice package which supports framed box with breaking option...

MadyYuvi
  • 13,693