2

Is it possible to clip a tabular in a box environment, so rows outside the box are hidden?

\documentclass{article}
\begin{document}
This is a table with multiple items:

\begin{minipage}[t][1cm][t]{0.5\linewidth}
    \begin{tabular}{|p{0.05\linewidth} | p{0.8\linewidth} |}
        \hline
        1--&this is a short item \\ \hline
        2--&this is a long item that is so long so it appears on multiple lines \\  \hline
        3--&this is another item\\  \hline
        4--&this is the last item\\  \hline
    \end{tabular}
\end{minipage}\\
But only 3 lines should be vissible (not 3 items)
\end{document}

1 Answers1

2

I believe that right solution most times would be rewrite-comment-remove that part outside the box. Otherwise, the touhamit's comment is just the solution that you are looking for. Example of use of the trimclip package:

mwe

\documentclass{article}
\usepackage{trimclip}
\def\exampletable{
\begin{tabular}{|p{0.025\linewidth}|p{0.4\linewidth}|}
\hline
1--&this is a short item \\ \hline
2--&this is a long item that is so long 
so it appears on multiple lines \\  \hline
3--&this is another item\\  \hline
4--&this is the last item\\  \hline
\end{tabular}}
\begin{document}

This is a table with multiple items:

\clipbox{0pt 50pt 0pt 0pt}{\exampletable}

But only 3 lines should be vissible (not 3 items)

\end{document}
Fran
  • 80,769