![如何为 LuaTeX 中的规则节点着色?](https://linux22.com/image/449123/%E5%A6%82%E4%BD%95%E4%B8%BA%20LuaTeX%20%E4%B8%AD%E7%9A%84%E8%A7%84%E5%88%99%E8%8A%82%E7%82%B9%E7%9D%80%E8%89%B2%EF%BC%9F.png)
当我做这样的事情时:
% !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
按顺序设定两者。