当我做这样的事情时:
% !TEX TS-program = lualatex
\documentclass[english]{book}
\usepackage{babel}
\directlua{
COL = node.subtype ( "pdf_colorstack" )
WHAT = node.id ( "whatsit" )
color_push = node.new ( WHAT, COL )
color_pop = node.new ( WHAT, COL )
color_push.stack = 0
color_pop.stack = 0
color_push.command = 1
color_pop.command = 2
color_push.data = "1 0 0 rg"
local function test ( head )
for n in node.traverse_id ( node.id ( "disc" ), head ) do
head = node.insert_before ( head, n.prev, node.copy ( color_push ) )
head = node.insert_before ( head, n, node.new ( node.id ( "rule" ) ) )
head = node.insert_after ( head, n.next, node.copy ( color_pop ) )
n.prev.subtype = 0
n.prev.width = 50000
end
return head
end
luatexbase.add_to_callback ( "pre_linebreak_filter", test, "test" )
}
\begin{document}
movement
\end{document}
我得到以下结果:
我怎样才能为规则节点着色?
答案1
rg
仅填充轮廓颜色,而描边颜色用 设定RG
。因此您需要1 0 0 rg 1 0 0 RG
按顺序设定两者。