Skip to content

Instantly share code, notes, and snippets.

View dohyunkim's full-sized avatar

Dohyun Kim dohyunkim

View GitHub Profile
@dohyunkim
dohyunkim / stamp.tex
Last active November 13, 2026 00:49
스탬프 찍기
\DocumentMetadata{ }
\documentclass[a4paper]{article}
\usepackage[hangul]{kotex}
\setmainhangulfont{Noto Serif CJK KR}[ Script=Hangul, Language=Korean ]
\ExplSyntaxOn
\box_new:N \GoodStampBox
\hbox_set:Nn \GoodStampBox { \graphics_include:nn { } { GoodStamp.png } }
\box_resize_to_wd:Nn \GoodStampBox { 40pt } % \includegraphics[width=40pt]
\int_new:N \g_stamp_count_int
\NewDocumentCommand \Stamp { s } {
@dohyunkim
dohyunkim / transformshading.tex
Created September 2, 2026 00:55
matrix transformation of shading in luamplib
\documentclass{article}
\usepackage{luamplib}
\pagestyle{empty}
\begin{document}
\mpfig
filldraw fullcircle scaled 100 shifted (100,50)
withshadingmethod "linear"
withshadingcolors (red, blue)
withshadingmatrix "shifted (-100,-50) rotated 45 shifted (100,50)"
;
@dohyunkim
dohyunkim / shadelines.tex
Created August 19, 2026 04:05
shading the lines
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\mpfig
numeric u, v;
u = 2v = 25;
path xx, yy;
xx = (left--right) scaled 3u;
@dohyunkim
dohyunkim / shadow.tex
Last active August 10, 2026 21:30
shadow effect with coons patch shading
\documentclass{article}
\usepackage{luamplib}
\pagestyle{empty}
\begin{document}
\mpfig*
numeric sh, wd, ht;
sh = 6; wd = 200; ht = 100;
path p[];
p1 = unitsquare xscaled wd yscaled ht;
p2 = unitsquare xscaled (wd-sh) yscaled sh shifted(sh,-sh);
@dohyunkim
dohyunkim / colorwheel.tex
Last active July 31, 2026 08:38
color wheel mimicking mac color select
\documentclass[margin=5pt]{standalone}
\usepackage{luamplib}
\begin{document}
\mpfig
u := 100;
color yellow; yellow = (1, 1, 0);
color cyan; cyan = (0, 1, 1);
color magenta; magenta = (1, 0, 1);
path p, q;
@dohyunkim
dohyunkim / getcontent.lua
Last active August 27, 2026 01:28
get content from tagged pdf
local doit = true
for line in io.lines(arg[1]) do
if doit and line:find"<?MarkedContent " then
local content = line:match">(.-)$"
if content and content ~= "" then
io.write(content)
end
elseif doit and line:find"</?P[%s>]" then
io.write"\n"
elseif line:find"<Lbl " then
@dohyunkim
dohyunkim / colormask.tex
Created March 12, 2026 07:54
masking by color
\documentclass{article}
\begin{document}
\ExplSyntaxOn
\mode_leave_vertical:
\hbox_overlap_right:n
{
\color_select:n{red!50}
\rule{200pt}{250pt}
}
\hbox_set:Nn \l_tmpa_box
@dohyunkim
dohyunkim / image-mask.tex
Last active March 2, 2026 01:00
image masking with luamplib
\documentclass[a5paper]{article}
\usepackage{luamplib,graphicx}
\directlua{
tex.print(-2,{
token.create"graphicspath",
token.new(0,1), token.new(0,1),
kpse.var_value"TEXMFDIST", "/doc/generic/pgf/images/",
token.new(0,2), token.new(0,2),
})
}
@dohyunkim
dohyunkim / krv_regex.lua
Last active March 4, 2026 05:52
override regex... commands in krvtypeset.cls
--
-- Only for krvtypeset.cls 2025/11/02 version 0.66
--
-- written by dohyun kim
-- public domain
-- 2026/03/03 22:00
--
-- 프리앰블 말미에
-- \directlua{ require "krv_regex" }
-- 를 추가하고 컴파일한다.
@dohyunkim
dohyunkim / wavethetext.tex
Last active March 10, 2026 06:13
wave the text with luamplib
\documentclass[margin=5pt]{standalone}
\usepackage{luamplib}
\begin{document}
\setbox0\vbox{\sffamily\bfseries\Large \sloppy
\hsize=10cm \parindent=0pt\parskip=5pt
\begin{center}\LARGE Episode IV\end{center}
\centerline{A NEW HOPE}
It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.