아래의 소스는 koTeX 2012 이상이면 컴파일되는 TeX 소스이다.

TeXworks 에서 XeLaTeX  으로 컴파일하면 에러는 없자만 소스 리스팅 부분이 제대로 반영되지 않는다. 차라리 명령줄애서 --shell-escape 옵션을 주고  xelatex 명령으로 컴파일하는 것이 확실하다.

\begin{pyglist}[language=python,encoding=utf8]

처럼 옵션 encoding=utf8 이 있어야 한글이 출력된다,

 

컴파일하기:

프롬프트> xelatex --shell-escape ex-verbments-01.tex

 

* 파일명:  ex-verbments-01.tex

\documentclass{article}


\usepackage{kotex}

\usepackage{verbments}



\begin{document}

verbments 패키지를 이용한 한글 테스트...


\begin{pyglist}[language=python,encoding=utf8]

#!C:\Python32\python.exe

# EASY-INSTALL-ENTRY-SCRIPT: 'pygments==1.5','console_scripts','pygmentize'

__requires__ = 'pygments==1.5'

import sys

from pkg_resources import load_entry_point


# 한글 주석

if __name__ == '__main__':

    sys.exit(

        load_entry_point('pygments==1.5', 'console_scripts', 'pygmentize')()

    )


\end{pyglist}


\begin{pyglist}[language=c,encoding=utf8]

int main() {

    printf("Hello, 안녕하세요?\n");

}

\end{pyglist}


\end{document}

 

 

출력된 PDF 파일:

ex-verbments-01.pdf

 

 

Posted by Scripter
,

아래의 소스는 koTeX 2012 이상이면 컴파일되는 TeX 소스이다.

TeXworks 에서 XeLaTeX  으로 컴파일하면 -shell-escape 옵션이 필요하다는 에러 메시지가 뜬다.

 

컴파일하기:

프롬프트> xelatex --shell-escape ex-minted-01.tex

 

* 파일명:  ex-minted=01.tex

\documentclass[12pt,a4paper]{article}


\usepackage{kotex}

\usepackage{hyperref}

\usepackage{minted}


\begin{document}


% v\begin{minted}[ruby]

\begin{minted}{ruby}

=begin

Usual operators(평범한 사칙연산자):

+ addition(덧셈)

- subtraction(뺄셈)

* multiplication(곱셈)

/ division(나눗셈)

=end


a = 5 + 3

b = 5 / 3

put "Hello, 안녕하세요?"

\end{minted}


 

출력된 PDF 파일:

ex-minted-01.pdf

 

 

 

Posted by Scripter
,

아래의 소스는 koTeX 2012 이상이면 컴파일되는 TeX 소스이다.

TeXworks 에서 XeLaTeX  으로 컴파일해도 되고, pdfLaTeX 으로 컴파일해도 된다.

한글이 정상적으로 출력되게 하려면,

\begin{lstlisting}[frame=single,escapeinside=~~]

처럼 옵션 escapeinside=~~ 을 주고 ~아무개~ 하면 아무개가 출력된다.

만일 옵션 escapeinside=^$ 을 주었다면 ^아무개$ 해야 아무개가 출력된다.

 

* 파일명:  ex-listings=03.tex

 \documentclass{article}


\usepackage{kotex}

\usepackage[T1]{fontenc}

\usepackage{listings} % Include the listings-package

\usepackage{color}

\usepackage{tikz}


\begin{document}


\lstset{ % Set your language (you can change the language for each code-block optionally)

language=Pascal,

tabsize=2,

extendedchars=true,

texcl=true,

stringstyle=\color{black!50}\ttfamily, basicstyle=\small\sffamily,

numbers=left,

numberstyle=\tiny,

frame=tb,

columns=fullflexible,

showstringspaces=false

}


\begin{lstlisting}[frame=single,escapeinside=~~] % Start your code-block


for i:=maxint to 0 do

begin

{ do nothing }

end;

Write('Case insensitive ');

Write('Pascal keywords ~한글~');

\end{lstlisting}


\lstset{

language=C,

tabsize=2,

extendedchars=true,

texcl=true,

stringstyle=\color{black!50}\ttfamily, basicstyle=\small\sffamily,

numbers=left,

numberstyle=\tiny,

frame=tb,

columns=fullflexible,

showstringspaces=false

inputencoding=utf8

}


\vspace{1cm}


\begin{lstlisting}[escapeinside=~~]

#include <stdio.h>


#define N 10


/* Block ~블록~

* comment ~커멘트~ */

int main()

{

int i;

// Line comment.

puts("Hello world! ~안녕?~");

for (i = 0; i < N; i++)

{

puts("LaTeX is also great for programmers!");

}

return 0;

}

\end{lstlisting}


\end{document}


 

출력된 PDF 파일: 

ex-listings-03.pdf

 

 

 

 

 

Posted by Scripter
,

* Go 1.2 내려받기

(윈도우즈 용으로는 zip 파일이든 msi 파일이든 아무거나 내려받아 설치해도 된다.)

 

아래에서는 32비트 윈도우 XP 용으로 내려받아 테스트하였다.

Go 1.2 를 폴더 d:\go12 에 설치하였다.

 

* 테스트에 사용된 예제 파일: hello.go

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}

 

* Go 1.0.2 를 사용할 때 처럼, 명령(cmd)창을 열고 환경변수 PATH 를 설정한다.

프롬프트> set PATH=d:\go12\bin;%PATH%

 

* go run 멸형으로 hello.go 를 실행한다.

프롬프트> go run hello.go
# command-line-arguments
pack: cannot open $WORK\command-line-arguments\_obj\_go_.8


* 이번에는 -x 옵션을 추가히여 실행해 본다.

프롬프트> go run -x hello.go
WORK=C:\DOCUME~1......\Temp\go-build436098039
mkdir -p $WORK\command-line-arguments\_obj\
mkdir -p $WORK\command-line-arguments\_obj\exe\
cd C:\test\go12
"c:\\go\\pkg\\tool\\windows_386\\8g.exe" -o "......\\Temp\\
go-build436098039\\command-line-arguments\\_obj\\_go_.8" -p command-line-argumen
ts -complete -D _/C_/test/go12 -I "C:\\DOCUME~1\\......\\Temp\\go-build43
6098039" "C:\\test\\go12\\hello.go"
"c:\\go\\pkg\\tool\\windows_386\\pack.exe" grcP "C:\\DOCUME~1\\......\\Te
mp\\go-build436098039" "C:\\DOCUME~1\\......\\Temp\\go-build436098039\\co
mmand-line-arguments.a" "C:\\DOCUME~1\\......\\Temp\\go-build436098039\\c
ommand-line-arguments\\_obj\\_go_.8"
# command-line-arguments
pack: cannot open $WORK\command-line-arguments\_obj\_go_.8

 

* 이번에는 환경변수 GOROOT 를 Go 1.2 가 설치된 폴더로 지정하고 다시 실행해 본다.

프롬프트> set GOROOT=d:\go12

프롬프트> go run hello.go
hello, world

 

* go 가 사용하는 환경변수 알아보기.

프롬프트> go env
set GOARCH=386
set GOBIN=
set GOCHAR=8
set GOEXE=.exe
set GOHOSTARCH=386
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=
set GORACE=
set GOROOT=d:\go12
set GOTOOLDIR=d:\go12\pkg\tool\windows_386
set TERM=dumb
set CC=gcc
set GOGCCFLAGS=-g -O2 -m32 -mthreads
set CXX=g++
set CGO_ENABLED=1

* 이상으로 Go 1.2 를 실행하려면 GOROOT 환경변수가 꼭 필요함을 알 수 있다.

 

 

 

Posted by Scripter
,