
(저는 LaTeX를 처음 접합니다.) 길이를 센티미터 단위로 인쇄하려고 합니다. 내 코드는 다음과 같습니다.
\documentclass{article}
\begin{document}
\newdimen\mylength
\mylength=1in
\the\mylength
\end{document}
결과 출력은 다음과 같습니다.
72.27포인트
그러나 출력을 센티미터 단위로 표시하고 싶습니다. 예: \the dimen [cm]\mylength. 어떻게 해야 합니까?
답변1
\convertto
다음에서 매크로를 사용할 수 있습니다 .필립 구테(Philippe Goutet)의 포스트:
\documentclass{article}
\makeatletter
\def\convertto#1#2{\strip@pt\dimexpr #2*65536/\number\dimexpr 1#1}
\makeatother
\begin{document}
\newdimen\mylength
\mylength=1in
\convertto{cm}{\the\mylength} cm
\end{document}
산출:
2.54cm