Is there a way to create a box which has fixed width and height? I tried \parbox
and some similar things, but sometimes the text overflows.
If the text inserted would overflow: it should be resized to fit or it should be clipped (with a warning). Is any of these possible?
We can assume, that the inserted text is one continous paragraph.
Best Answer
You can use the
fitting
library of thetcolorbox
package. It provides a macro called\tcboxfit
which fits the font size of the content to the dimensions of the box. Alternatively, the optionfit
fortcolorbox
does the same trick.Note that the used font has to be resizable to all dimensions (vector font) to achieve the correct resizing.
The first example shows a framed box (can be adapted in many ways), the second one a box without a frame (the red border is just for displaying the size), the third example displays a box with title and fixed height.