KTUG 한국 텍 사용자 그룹

Menu

KTUG :: Q&A 마당 › description 환경에서 제일 긴 아이템 라벨 알아내기

yihoze | 2012.04.19 09:17:18 | 메뉴 건너뛰기 쓰기

\begin{description}

\item[My Location] Use current location for starting location.

\item[Contacts] Select from the contacts list.

\item[Point on map] Pinpoint by tapping on the map.

\item[My Places] Select from the list of favorite places.

\end{description}

여기에서 제일 라벨이 My Location입니다.
이 목록이 식자되지 않고, 단지 제일 긴 라벨인 My Location의 길이를 알아내는 방법이 있을까요?

***

해결했습니다,  이것으로 끝난 게 아니지만.

\newlength\curlabelwidth
\newlength\longlabelwidth
\newsavebox\labelbox
\xdef\longlabel{MM}

\newcommand\getlonglabel[1]{%
\sbox{\labelbox}{%
\begin{minipage}{\linewidth}%
#1%
\end{minipage}%
}\longlabel%
}

\newenvironment{tmplist}{
\begin{list}{}{%
\xdef\longlabel{MM}
\renewcommand\makelabel[1]{
\settowidth\curlabelwidth{##1}
\settowidth\longlabelwidth{\longlabel}
\ifdim \curlabelwidth > \longlabelwidth
\xdef\longlabel{##1}
\fi}
}}{\end{list}}

\getlonglabel{
\begin{tmplist}
\item[My Location] Use current location for starting location.
\item[Contacts] Select from the contacts list.
\item[Point on map] Pinpoint by tapping on the map.
\item[My Places] Select from the list of favorite places.
\end{tmplist}
}



댓글 쓰기

목록

KTUG 한국 텍 사용자 그룹