KTUGFaq

KTUG FAQ

·Î±×ÀÎ:
ºñ¹Ð¹øÈ£:
°¡ÀÔ
Your mode of life will be changed for the better because of good news soon.
FrontPage › ÆÄÀÏÀÔÃâ·Â
TeX ¿ª½Ã ÇÁ·Î±×·¡¹Ö ¾ð¾îÀ̱⠶§¹®¿¡ ÆÄÀÏ ÀÔÃâ·ÂÀÌ °¡´ÉÇÏ´Ù. ¿¹¸¦ µé¾î¼­ ¸í·É¾î¸¦ ¼öÇàÇÏ¸é ±× ³»¿ëÀ» Ãâ·ÂÇÏ´Â °Í ÀÌ¿Ü¿¡ ÆÄÀÏ¿¡ ÀúÀåÇÏ°í ½Í´Ù¸é ´ÙÀ½°ú °°ÀÌ ÇÏ¸é µÈ´Ù.


\newcommand\bme{\newwrite\example@out\immediate\openout \example@out hello.exa}% fopen
\newcommand\hello[2][\@empty]{%
  \ifx#1\@empty%1 No option
    \def\temp@val{1 : }%
  \else% Option
     \def\temp@val{#1 : }%
  \fi%
  \immediate\write\example@out{\temp@val #2}#2}% fwrite
\newcommand\eme{\immediate\closeout\example@out}% fclose

»ç¿ë¿¹´Â ³ªÀ½°ú °°´Ù.


\bme
\hello[3]{With parameter}
\hello{Without parameter}
\eme

·çºñ¸¦ ÀÌ¿ëÇÏ¿© »ý¼ºµÈ ÆÄÀÏÀ» ÅØÄÚµå·Î º¯È¯

À§ÀÇ ÅØÇÁ·Î±×·¥À» µ¹¸®¸é hello.exa °¡ »ý¼ºµÇ°í ÀÌ ÆÄÀÏ¿¡´Â ¾Õ¿¡¼­ º» ¹®ÀåµéÀÌ ±â·ÏµÇ¾î ÀÖ´Ù. À̸¦ ruby ¸¦ ÀÌ¿ëÇϸé(¹°·Ð ´Ù¸¥ ¾ð¾î -perl/python/lua/tcl µîµµ »ç¿ëÇÒ ¼ö ÀÖÁö¸¸ °¡Àå ½±°Ô ÀÌ¿ëÇÒ ¼ö ÀÖ´Â ·çºñ¸¦ ¿¹·Î µé¾ú´Ù.) itemize/enumerate ¸¦ Æ÷ÇÔÇÏ´Â ÅØÄÚµå·Î ¹Ù²Ü ¼ö ÀÖ´Ù. ÀÌ´Â ´ÙÀ½°ú °°´Ù.

# Program : Filter.rb
#  Input : File name
#  Output : LaTeX - description or item source code that is intended to be \input{}

# Global variable __LEVEL__ sets the level that is to be printed.
#  example) if __LEVEL__ = 2, 1 XXX is not printed 
$LEVEL = 1
$WHAT = "enumerate"

def process(filename_)
  f = File.new('res.tex','w')
  f << "\\begin{#{$WHAT}}\n"
  File.open(filename_) do |file|
    file.each_line do
      |line|
      if line =~ /^(\d+)\s:\s(.*)$/ # $1 -> number, $2 -> string 
        if ($LEVEL <= $1.to_i)
          f << '\item ' << $2 << "\n"
        end
      else
        puts 'No match'
      end
    end
  end
  f << "\\end{#{$WHAT}}\n"
  f.close()
end

if $0 == __FILE__
  # Argument Check
  if ARGV.length > 1
    puts "Usage : " + $0 + " filename"
    exit
  end
  puts 'processing >> ' + ARGV[0]
  file = ARGV[0]
  process(file)
end

^
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2007-02-05 08:53:38
Processing time 0.0368 sec