Skip to content

Instantly share code, notes, and snippets.

View dohyunkim's full-sized avatar

Dohyun Kim dohyunkim

View GitHub Profile
@dohyunkim
dohyunkim / lazydaum.tex
Last active August 20, 2026 03:13
lazy mimicking of daum logo
\documentclass[a4paper]{article}
\usepackage{luamplib}
\pagestyle{empty}
\begin{document}
\mpfig
picture pic; path p[]; color c[];
c1 = (1, 0.4, 0.4);
c2 = (1, 0.8, 0.3);
c3 = (0.3, 0.8, 0.3);
c4 = (0.3, 0.5, 1);
@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 / seclatexlab.tex
Last active July 30, 2026 08:41
hangul chapter, part format with new latex section templates
\DocumentMetadata{}
\documentclass{book}
\usepackage[hangul]{kotex}
\setmainhangulfont{Noto Serif CJK KR}[Script=Hangul, AutoFakeSlant]
\IfInstanceExistsT{heading}{chapter}
{\EditInstance{heading}{chapter}{prefix={\KSTHE}, number-format={\thechapter~\chaptername}}
\AddToHook{cmd/appendix/after}
{\EditInstance{heading}{chapter}{prefix={\appendixname}, number-format={\thechapter}}}}
\IfInstanceExistsT{heading}{part}
{\EditInstance{heading}{part}{prefix={\KSTHE}, number-format={\thepart~\partname}}}
@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 July 30, 2026 04:13
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.