KTUGFaq

KTUG FAQ

·Î±×ÀÎ:
ºñ¹Ð¹øÈ£:
°¡ÀÔ
Be careful how you get yourself involved with persons or situations that can't bear inspection.
FrontPage › SampleDocument/LuaTeX

r1.1°ú ÇöÀç ¹öÀüÀÇ Â÷ÀÌÁ¡

@@ -1,3 +1,34 @@
== ¿À´ÃÀÇ ºñƲÁî °¡»ç ==
KTUGBoard:8600
¾Æ·¡ÀÇ Äڵ带 luatexÀ¸·Î ½ÇÇàÇϸé,
½ÇÇàÇÒ¶§¸¶´Ù »õ·Î¿î ºñƲÁî °¡»ç¸¦ ¾òÀ» ¼ö ÀÖ½À´Ï´Ù.
beatles.lua
{{{
local http = require("socket.http")
local archiveUrl = "http://www.beatleslyricsarchive.com/viewSong.php?songID="..math.random(1,439)
local htmlBody = http.request(archiveUrl)
local s, t, title, lyrics
s, t, title = string.find(htmlBody, '<h1>(.-)%s*<i>.-</i></h1>')
tex.print('{\\titlefont '..title..'}\\bigskip\\bigskip')
s, t, lyrics = string.find(htmlBody, '<td width=\"25\"> </td>%s*<td>%s*(.-)%s*</td>')
lyrics = string.gsub(lyrics, '<br>', '\\par ')
tex.print(lyrics)
}}}
beatles.tex
{{{
\magnification=\magstep1
\input kotexplain
\font\titlefont=cmbx10 at 18pt
\nopagenumbers
\directlua{ dofile(kpse.find_file("beatles.lua")) }
\bye
}}}
== ¹ßÁÖ¼­ ¸¸µé±â ==

¹ßÁÖ¼­(°ßÀû¼­ ¶Ç´Â û±¸¼­)ÀÇ ¿ä¼Ò¸¦ ¸ÕÀú »ìÆì º¸ÀÚ.



¿À´ÃÀÇ ºñƲÁî °¡»ç


¾Æ·¡ÀÇ Äڵ带 luatexÀ¸·Î ½ÇÇàÇϸé, ½ÇÇàÇÒ¶§¸¶´Ù »õ·Î¿î ºñƲÁî °¡»ç¸¦ ¾òÀ» ¼ö ÀÖ½À´Ï´Ù.

beatles.lua
local http = require("socket.http")
local archiveUrl = "http://www.beatleslyricsarchive.com/viewSong.php?songID="..math.random(1,439) 
local htmlBody = http.request(archiveUrl) 
local s, t, title, lyrics 

s, t, title = string.find(htmlBody, '<h1>(.-)%s*<i>.-</i></h1>') 
tex.print('{\\titlefont '..title..'}\\bigskip\\bigskip') 

s, t, lyrics = string.find(htmlBody, '<td width=\"25\">&nbsp;</td>%s*<td>%s*(.-)%s*</td>') 
lyrics = string.gsub(lyrics, '<br>', '\\par ') 
tex.print(lyrics)
beatles.tex
\magnification=\magstep1 
\input kotexplain 
\font\titlefont=cmbx10 at 18pt 
\nopagenumbers 

\directlua{ dofile(kpse.find_file("beatles.lua")) } 

\bye

¹ßÁÖ¼­ ¸¸µé±â


¹ßÁÖ¼­(°ßÀû¼­ ¶Ç´Â û±¸¼­)ÀÇ ¿ä¼Ò¸¦ ¸ÕÀú »ìÆì º¸ÀÚ.
  1. º¸³»´Â »ç¶÷(°÷)ÀÇ Á¤º¸°¡ ÀÖ´Ù.
  2. ¹Þ´Â »ç¶÷(°÷)ÀÇ Á¤º¸°¡ ÀÖ´Ù.
  3. º¸³»´Â ³¯Â¥¿Í ¹®¼­ÀÇ ¹øÈ£°¡ ÀÖ´Ù.
  4. ¼ö·®, ´Ü°¡, ÃÑ¾× µîÀÇ Ç¥½ÃµÈ Ç¥°¡ ÀÖ´Ù.
  5. Á÷ÀÎ ¶Ç´Â ¼­¸íÀÌ ÀÖ´Ù.

¿öµå ÇÁ·Î¼¼¼­·Î ¸¸µç´Ù¸é,
  1. °è»êÀ» µû·Î Çؼ­ °ªÀ» ³Ö¾îÁà¾ß ÇÑ´Ù.
  2. õ ÀÚ¸® ¶ç¾î ¾²±â³ª ¼Ò¼öÁ¡ Ç¥±â¸¦ ±¹°¡ Ç¥ÁØ¿¡ ¸Â°Ô °íÃÄÁà¾ß ÇÑ´Ù.

±×·¸´Ù¸é ¿Ö ¿¢¼¿À» ¾²Áö ¾Ê°í, ·ç¾îÅØÀ» ¾²´Â°¡?
  1. ¹ßÁÖ¼­ÀÇ °¢ ¿ä¼Ò¸¦ ¸ðµâ·Î ¸¸µé ¼ö ÀÖ´Ù.
  2. PDF¸¦ ½±°Ô ¸¸µé ¼ö ÀÖ´Ù.
  3. ¹®¼­¸¦ º¸±â ÁÁ°Ô ¸¸µé ¼ö ÀÖ´Ù.
  4. °è»êÀÌ °¡´ÉÇÏ°í ±Ý¾× Ç¥½Ã¸¦ °¢ ±¹°¡ Ç¥ÁØ¿¡ ¸Â°Ô ÇÒ ¼ö ÀÖ´Ù. (ÀÌ°Ç sistyle ÆÐÅ°Áö°¡ ÇØ ÁØ´Ù.)

\documentclass[a4paper,11pt]{memoir}
\input{po}

\ServiceProvider{%
SAMSONG\\
763-10 Bugok-dong Sangnok-gu\\
Ansan
}

\ProviderContact{James Bond}

\PurchaseOrderNumber{J9216A}
\PurchaseOrderDate{16th February 2009}

\SIstyle{Switzerland}

\begin{document}

\thispagestyle{empty}

\directlua0{
        array = {
                {"Desktop computer: DW-101X", 8, 1200},
                {"Laptop computer: LW-804K", 4, 2500}
        }
}
\PurchaseOrder
\end{document}

po.texÀº ÀÌ·¸´Ù.
\usepackage{sistyle}

\newcommand{\paymentcurrency}{}
\newcommand{\PaymentCurrency}[1]{\renewcommand\paymentcurrency{#1}}
\PaymentCurrency{\EUR}


\AddToSIstyle{Europe}{
\SIgroupfourfalse
\SIthousandsep{\,}
\SIdecimalsign{,}
\PaymentCurrency{\EUR}
}

\AddToSIstyle{Switzerland}{
\SIgroupfourfalse
\SIthousandsep{'}
\SIdecimalsign{,}
\PaymentCurrency{CHF}
}

\AddToSIstyle{UK}{
\SIgroupfourfalse
\SIthousandsep{,}
\SIdecimalsign{.}
\PaymentCurrency{\pounds}
}

\AddToSIstyle{USA}{
\SIgroupfourfalse
\SIthousandsep{,}
\SIdecimalsign{.}
\PaymentCurrency{\$}
}

\setulmarginsandblock{3cm}{3cm}{*}
\setheadfoot{1.5cm}{1cm}
\setlrmarginsandblock{2.5cm}{2.5cm}{*}
\checkandfixthelayout
\makeoddhead{empty}{}{}{KTUG}

\newcommand{\purchaseordernumber}{}
\newcommand{\PurchaseOrderNumber}[1]{\renewcommand\purchaseordernumber{#1}}
\newcommand{\purchaseorderdate}{}
\newcommand{\PurchaseOrderDate}[1]{\renewcommand\purchaseorderdate{#1}}

\newcommand{\serviceprovider}{}
\newcommand{\ServiceProvider}[1]{\renewcommand\serviceprovider{#1}}
\newcommand{\providercontact}{}
\newcommand{\ProviderContact}[1]{\renewcommand\providercontact{\textbf{#1} }}

\newcommand{\servicepurchaser}{}
\newcommand{\ServicePurchaser}[1]{\renewcommand\servicepurchaser{#1}}
\newcommand{\purchasercontact}{}
\newcommand{\PurchaserContact}[1]{\renewcommand\purchasercontact{\textbf{#1} }}
\newcommand{\purchasersignature}{}
\newcommand{\PurchaserSignature}[1]{\renewcommand\purchasersignature{#1}}
\newcommand{\purchaserremark}{}
\newcommand{\PurchaserRemark}[1]{\renewcommand\purchaserremark{\textbf{Remark}:\\#1}}

\newcommand{\breakdownfont}{}

\newcommand{\tmpamount}{}

\ServicePurchaser{%
TOPFIELD Co., Ltd.\\
Topfield Bldg. 207 Geumgok-dong Bundang-gu Seongnam Korea 463-869\\
+82 31 778 0845
}
\PurchaserContact{Jimmy LEE}
\PurchaserSignature{JimmyLEE}

\newcommand{\PurchaseOrder}{
\sffamily\vspace*{2ex}

\serviceprovider

\providercontact

\vspace{2ex}
\centerline{\Huge\textsc{Purchase Order}}
\vspace{2ex}

Number \purchaseordernumber

Please execute the following order under the terms and conditions stated below.

\PurchaseOrderBreakdown

\vspace{4ex}
\purchaserremark

\purchaseorderdate
\vspace{2ex}

\servicepurchaser

\purchasercontact

\hspace*{1cm}\purchasersignature
}

\newcommand{\PurchaseOrderBreakdown}{
\breakdownfont
\begin{tabularx}{\textwidth}{|X|r|r|r|}
\hline
Description & Quantity & Unit Price & Amount \tabularnewline
\hline
%
\directlua0{
        CurRow = 1
        TotRow = 10
        i = 1
        total = 0
        while array[i] do
                array[i][4] = array[i][2] * array[i][3]
                total = total + array[i][4]
                str = array[i][1].."&"..array[i][2].."& \string\\num{"..array[i][3].."}\string\\,\string\\paymentcurrency & \string\\num{"..array[i][4].."}\string\\,\string\\paymentcurrency\string\\tabularnewline\string\\hline"
                tex.print(str)
                CurRow = CurRow + 1
                i=i+1
        end
        while CurRow <= TotRow do
                str = "& & & \string\\tabularnewline\string\\hline"
                tex.print(str)
                CurRow = CurRow + 1
        end
}
\multicolumn{3}{|r|}{\textsc{Total}} & \num{\directlua0{tex.print(total)}}\,\paymentcurrency\tabularnewline
\hline
\end{tabularx}
}

\setlength{\parindent}{0em}
\endinput


À§ ÄÚµå´Â ÄÄÆÄÀÏ °¡´ÉÇÏÁö¸¸ ¿ÏÀüÈ÷ ÀÌÇØÇÏ·Á¸é ¾à°£ÀÇ ¼³¸íÀ» µ¡ºÙ¿©¾ß ÇÑ´Ù. ¾ÆÀ̵ð¾î Â÷¿ø¿¡¼­ Âü°íÇÏ½Ã±æ ¹Ù¶õ´Ù. pdflualatexÀ» ÀÌ¿ëÇÏ¿´´Ù.

po_sample_1.jpg

Contributor hoze