# Cut off text height at a given value

Is it possible to have a text box which cuts of text running out of its height? Considering the following minimal working example, I would like to have the text in the first parbox to be cut of as soon as it flows out of the 20mm height:

\documentclass[a4paper]{scrartcl}
\usepackage{polyglossia}                % language package
\setmainlanguage{english}               % select language for polyglossia
\begin{document}
\parbox[c][20mm][t]{20mm}{\strut\hspace{0pt}Some Text in the first column which is higher, than 20mm in total \strut}\par
\parbox[t]{50mm}{\strut\hspace{0pt}Some other Text, which should be here \strut}\par
\end{document}


I would like to have a behavior similar to HTML resp. CSS

<div style="overflow: hidden; width: 20mm; height: 20mm;"></div>

• i can think of two possible approaches: (1) make the subject box into a graphic, at which point functions like clip can be applied, or (2) overprint it with a white band (again using a graphics approach). i don't know of any non-graphical approach. – barbara beeton Feb 25 '15 at 14:53

Using the trimclip packages \clipbox macro with all values set to 0pt seams to do the trick as exacted:

\documentclass[a4paper]{scrartcl}
\usepackage{polyglossia}                % language package
\usepackage{trimclip}                   % provides the \clipbox macro
\setmainlanguage{english}               % select language for polyglossia
\begin{document}
\clipbox{0pt 0pt 0pt 0pt}{\parbox[c][20mm][t]{20mm}{\strut\hspace{0pt}Some Text in the first column which is higher, than 20mm in total \strut}}\par
\parbox[t]{50mm}{\strut\hspace{0pt}Some other Text, which should be here \strut}\par
\end{document}


The trimclip package can be used within tikz environment. If you are interested in clipping within a pspicture using pstricks you have to use the \clipbox makro provided by pstricks which has a slightly different syntax as can be see in chapter 28 of the pstricks User's guide.

• Unfortunately this doesn't seam to work within a pspicture environment … :-( – white_gecko Feb 25 '15 at 15:40
• Ok, this package doesn't work in pstricks. pstricks rather holds its own implementation of \clipbox as can be see in chapter 28 of the pstricks User's guide ftp.gwdg.de/pub/ctan/graphics/pstricks/base/doc/…. – white_gecko Feb 25 '15 at 17:22