Skip to content

Instantly share code, notes, and snippets.

View dohyunkim's full-sized avatar

Dohyun Kim dohyunkim

View GitHub Profile
@dohyunkim
dohyunkim / ucharclass.tex
Last active May 10, 2016 04:17
it's not easy to use ucharclasses package with polyglossia korean.
%!TEX program = xelatex
\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{korean}
\newfontfamily\koreanfont{NanumMyeongjo}[Ligatures=TeX]
\usepackage{ucharclasses}
\setTransitionsForCJK{\begingroup\koreanfont
\XeTeXlinebreaklocale"ko"
\XeTeXlinebreakpenalty=50
@dohyunkim
dohyunkim / dofirst.tex
Created February 27, 2016 11:12
단어의 첫 글자만 다르게
% see http://www.ktug.org/xe/index.php?document_srl=214192
\def\dofirst#1{\dodofirst#1 \stopdofirst{} }
\def\dodofirst#1 {%
\ifx\stopdofirst#1%
\unskip
\else
\in@{,#1,}{,a,am,an,of,for,in,on,the,to,with,}%
\ifin@
\else
\expandafter\DoFirst
@dohyunkim
dohyunkim / readcsv.lua
Last active January 8, 2016 13:37
read csv and print latex tabular
readcsv = readcsv or {}
local readcsv = readcsv
local function readcsvlines (s, sep)
sep = sep or ','
s = s .. "\n"
s = s:gsub("[\r\n]+", "\n") -- unix newline
local curr, t = 1, {{}}
while true do
local tt, i, a, c = t[#t], curr
--
-- This is file `luamplib.lua',
-- generated with the docstrip utility.
--
-- The original source files were:
--
-- luamplib.dtx (with options: `lua')
--
-- See source file 'luamplib.dtx' for licencing and contact information.
--
@dohyunkim
dohyunkim / fontcharglyph.tex
Created September 9, 2015 12:17
view all chars from current font (lualatex only)
\documentclass[a4paper]{article}
\usepackage{fontspec, luacode, xcolor}
%\setmainfont{HCR Batang LVT}[Script=Hangul, Language=Korean]
\setmainfont{Linux Libertine O}
%\setmainfont{TeX Gyre Pagella}
%\setmainfont{Source Han Sans K}[Script=Hangul, Language=Korean]
%\setmainfont{NanumMyeongjoOTF YetHangul}[Script=Hangul, Language=Korean]
%\setmainfont{NanumBarunGothicOTF YetHangul}[Script=Hangul, Language=Korean]
\pagestyle{myheadings} \markright{\footnotesize\fontname\font}
\def\tickblue{{\color{blue}\vrule width1pt height.05pt depth.05pt}}
@dohyunkim
dohyunkim / mpcalc.tex
Last active August 29, 2015 14:23
MetaPost as a math calculator
\input luamplib.sty
\def\mpcalc#1#2#3{% #1 control sequence
% #2 math formular
% #3 precision ( <= 1000 )
\begingroup
\setbox0\hbox{%
\mplibnumbersystem{decimal}%
\mplibcode
numberprecision := #3;
@dohyunkim
dohyunkim / fontglyphs.sty
Last active September 7, 2015 10:56
draw glyph box for each and every glyph in a truetype/opentype font
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname selectfont\endcsname\relax
\edef\catcodeofatchar{\catcode`@=\the\catcode`@}
\catcode`@=11
\newdimen\@tempdima \newdimen\@tempdimb
\newcount\@tempcnta \newcount\@tempcntb
\else
\ProvidesPackage{fontglyphs}[2015/06/15 v0.1 Draw box of each and every glyphs in a truetype/opentype font]
\fi
@dohyunkim
dohyunkim / r.pl
Last active August 29, 2015 14:22
romanization of hangul pronunciation -- 제1차 라텍 스터디 과제
#!/usr/bin/env perl
my @LC = map {$_ eq "-" ? "" : $_} qw(
g kk n d tt r m b pp s ss - j jj ch k t p h
);
my @MV = qw(
a ae ya yae eo e yeo ye o wa wae oe yo u wo we wi yu eu ui i
);
my @TC = map {$_ eq "-" ? "" : $_} qw(
- G kk ks n nj nh D R lG lm lB ls lt lp lh m B ps s ss ng j ch k t p h
@dohyunkim
dohyunkim / drawcharbox.lua
Last active November 15, 2018 03:37
draw box around glyphs
luatexbase.provides_module(
{
name = 'drawcharbox',
date = '2011/05/20',
version = 0.2,
description = 'draw char box for each char',
author = 'Dohyun Kim',
license = 'Public Domain',
})
@dohyunkim
dohyunkim / colorVerb.lua
Last active August 29, 2015 14:22
colorize verbatims
luatexbase.provides_module({
name = 'colorVerb',
date = '2011/01/20',
version = 0.1,
description = 'Colorize Commands/Braces/Brackets in Verbatim',
author = 'Dohyun Kim',
license = 'Public Domain',
})
colorVerb = colorVerb or {}