Skip to content

Instantly share code, notes, and snippets.

View dohyunkim's full-sized avatar

Dohyun Kim dohyunkim

View GitHub Profile
@dohyunkim
dohyunkim / charboxes.tex
Last active December 31, 2015 01:39
사용자가 지시한 폰트에 들어있는 모든 글리프를 박스를 둘러 보여준다.
\message{^^JName of the font to test = }
\bgroup
\endlinechar-1
\global\read-1 to\myfontname
\egroup
\ifx\empty\myfontname
\def\myfontname{ec-lmr12}
\fi
\font\myfont=\myfontname\space at 15pt
\def\numtohex{%
@dohyunkim
dohyunkim / trans.tex
Created December 29, 2013 16:11
test file for transparency. Current (Dec. 2013) luaotfload-colors.lua conflicts with luamplib package on the development.
\input luaotfload.sty
\input luamplib.sty
\mplibsetformat{metafun}
\mplibcode
beginfig(0);
path p; p:= unitcircle scaled 2cm;
fill p withcolor transparent("normal",0.5,red);
fill p xshifted 1cm withcolor transparent("normal",0.5,blue) ;
endfig;
\endmplibcode
@dohyunkim
dohyunkim / ivstest.tex
Last active January 2, 2016 16:09
HanaMin IVS test file
\documentclass{article}
\usepackage{xetexko}
\setmainhanjafont{HanaMinA}
\newfontfamily\fallbackhanjafont{HanaMinB}
\begin{document}
%\hanjacjksymbols % or \prevfontcjksymbols % not needed any more
\Huge
道\char"E0100
道\char"E0101
@dohyunkim
dohyunkim / mpbackground.tex
Created January 14, 2014 08:30
mplib figure as a page background
%\pdfcompresslevel=0
%\pdfobjcompresslevel=0
\input luamplib.sty
\mplibsetformat{metafun}
\newbox\MpPageBg
\setbox\MpPageBg\hbox{%
\mplibcode
beginfig(0);
draw btex D R A F T etex scaled 14 rotated 60
withcolor transparent("normal", 0.2, black);
@dohyunkim
dohyunkim / mpvarshare.tex
Created January 27, 2014 05:49
sharing metapost variables between mplibcode environments: a proof of concept
\documentclass{article}
\usepackage{luamplib}
\everymplib{
if (readfrom "mymplibtmp.mp" <> EOF):
input mymplibtmp;
fi;
closefrom "mymplibtmp.mp";
if unknown u: u := 10; fi;
beginfig(0);
}
@dohyunkim
dohyunkim / mpzref.tex
Last active January 4, 2016 15:59
zref + mplib: a proof of concept
\documentclass[a4paper]{article}
\usepackage{luamplib, zref-savepos, atbegshi, picture}
\begin{document}
\AtBeginShipoutNext{\AtBeginShipoutUpperLeft{%
\put(0,-\paperheight){%
\begin{mplibcode}
beginfig(0);
x0 := \mpdim{\zposx{z0x} sp};
y0 := \mpdim{\zposy{z0y} sp};
x1 := \mpdim{\zposx{z1x} sp};
@dohyunkim
dohyunkim / numbers.mp
Last active August 29, 2015 13:56
metapost로 cases 그리기. mptopdf 명령으로 컴파일한다.
verbatimtex \input kotexutf.tex etex;
input boxes;
input cmarrows;
setup_cmarrows(
brace_name = "Biggbrace";
parameter_file = "cmr12.mf";
macro_name = "LeftBrace"
);
def leftbrace (suffix tt,bb) =
LeftBrace (bb.sw+up*bb.dy -- tt.nw+down*tt.dy)
@dohyunkim
dohyunkim / numbers.tex
Created February 17, 2014 16:53
number cases with luamplib. a patch to finder needed for ".mf" file.
\documentclass{minimal}
\usepackage[hangul]{kopubfonts}
\usepackage{luamplib}
\def\cropmplibwithmargin#1{%
\pdfhorigin#1 \pdfvorigin\pdfhorigin
\pdfpagewidth\dimexpr\MPwidth+2\pdfhorigin\relax
\pdfpageheight\dimexpr\MPheight+2\pdfvorigin\relax
}
\begin{document}
\begin{mplibcode}
@dohyunkim
dohyunkim / tex-units.tex
Created March 4, 2014 13:45
units in tex
\begingroup
\catcode`P=12 \catcode`T=12
\lowercase{\endgroup\def\removept#1.#2PT{#1\ifnum#2>0 .#2\fi}}
\def\strippt{\expandafter\removept\the}
\def\convertto#1#2{\strippt\dimexpr#2*65536/\dimexpr1#1\relax\relax}
\def\headertt#1#2{\bf #1}
\halign{\bf#\hfill &
\quad\convert{#}{1pt}\hfil &
\quad\convert{#}{1mm}\hfil &
@dohyunkim
dohyunkim / tangentline.tex
Created May 29, 2014 00:12
임의의 곡선에 접선 그리기
\documentclass[border=2pt]{standalone}
\usepackage{luatexko}
\usepackage{luamplib}
\mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
beginfig(0);
u = 1cm;
rgbcolor juwhang; juwhang = (1, 1/2, 0);