避免文本在乳胶盒外溢出

问题描述 投票:0回答:1

我有一个长文本(大小未知),但是我只有一个固定的大小来显示它。为避免文本溢出此空间,我希望将其裁剪以使其足够小以在其中输入。

例如,使用以下代码,我们看到文本比可用空间长得多(由方框表示)。因此,我想知道如何剪切溢出框的文本,以缩短它(此示例中缩短为100pt)。

\documentclass{article}


\begin{document}

    \fbox{
    \parbox[][100pt][t]{3cm}{
        The quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog.
    }
    }

\end{document}

enter image description here

latex
1个回答
0
投票

adjustbox包的一种可能方法:

\documentclass{article}

\usepackage{adjustbox}

\begin{document}


\begin{adjustbox}{minipage=[t][3cm][t]{100pt},frame,clip=true,trim=0cm 0cm 0cm 0cm}
  The quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog.
\end{adjustbox}


\end{document}

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.