剪辑框环境到高度/宽度

剪辑框环境到高度/宽度

是否可以在框环境中剪辑表格,以便隐藏框外的行?

\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

我认为大多数情况下正确的解决方案是重写注释并删除框外的部分。否则,touhamit 的注释就是您要寻找的解决方案。包使用示例trimclip

姆韦

\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}

相关内容