코드를 줄이기 위해 장식은 생략했다. lualatex으로 실행하며 0.5초면 컴파일 완료된다.
우선 log.lua 파일:
local log10 = math.log10 local format = string.format local function round (num, idp) return format("%." .. (idp or 0) .. "f", num) end local function log (num) return round(log10(num), 4) end local n = 1 function inclog () tex.sprint(log(n)) n = n + 0.01 end
이제 logtab.tex 파일:
\documentclass[a4paper,landscape]{article} \usepackage[hmargin=7mm,vmargin=14mm]{geometry} \directlua{dofile('log.lua')} \def\ln{\directlua{inclog()}} \newcount\n\n=0 \newcount\m \def\stepn{\global\m=-1 \global\advance\n1 } \def\stepm{\global\advance\m1 } \def\ll{\stepm\the\n.\the\m&\ln&\ln&\ln&\ln&\ln&\ln&\ln&\ln&\ln&\ln\\} \def\Vll{\stepn\Vllt} \def\Vllt{\ll\ll\ll\ll\ll} \def\Xll{\Vll\Vllt} \def\Hl{&0&1&2&3&4&5&6&7&8&9\\} \parindent0pt \pagestyle{empty} \begin{document} \centerline{Common Logarithms Table} \small \begin{tabular}{ccccccccccc}\hline \Hl\hline \Xll\Xll\Xll\Xll\Vll\hline \end{tabular}\hfill \begin{tabular}{ccccccccccc}\hline \Hl\hline \Vllt\Xll\Xll\Xll\Xll\hline \end{tabular} \end{document}
KTUG 한국 텍 사용자 그룹