1

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}

enter image description here

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

<div style="overflow: hidden; width: 20mm; height: 20mm;"></div>
  • 1
    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
1

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}

enter image description here

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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