KTUG 한국 텍 사용자 그룹

Menu

KTUG :: Q&A 마당 › 일정한 크기의 박스에 텍스트 넣기

yihoze | 2020.07.09 14:52:33 | 메뉴 건너뛰기 쓰기

가로와 세로를 지정한 박스에 텍스트를 넣다가 박스가 넘치게 되면 그만두는 (나머지는 텍스트는 버리는) 그런 걸 만들어보고자 합니다. 쉽지 않으리라 생각했지만, interface3 문서를 보면서 이것저것 해보았는데, 단서조차 잡지 못하겠습니다.

fixed_size_box.png

그러니까 셋째 박스에서 drop box contents가 끝에 걸리니까 이 줄을 그냥 버리고 싶습니다. MWE로서 전혀 도움이 되지 않겠지만 ...

\documentclass[a4paper]{article}
\usepackage{xparse}
\def\ltext{Vertical boxes inherit their baseline from their contents. The standard case is that the baseline of the box is at the same position as that of the last item added to the box.}
\def\rtext{The functions above for using box contents work in exactly the same way as for any other expl3 variable. However, for efficiency reasons, it is also useful to have functions which drop box contents on use. When a box is dropped, the box becomes empty at the group level where the box was originally set rather than necessarily at the current group level.}
\ExplSyntaxOn
\NewDocumentCommand \textbox { m }
{
    \fbox{
        \begin{minipage}[l][5em]{20em}
            #1
        \end{minipage}
    }
}
\ExplSyntaxOff
\setlength\parindent{0pt}
\begin{document}
\textbox{test}
\ltext
\textbox{\ltext}
\rtext
\textbox{\rtext}
\end{document}

* * *

이게 꼭 필요한 건 아니고 공부삼아 해보려 한 것인데, 길을 잃었습니다.

첨부 [1]

댓글 [3]

댓글 쓰기

목록

KTUG 한국 텍 사용자 그룹