Skip to content

Commit

Permalink
fix(packages): Combine unichar output with existing unshaped node
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens authored and alerque committed Jul 23, 2020
1 parent c1b1c2b commit 712bc92
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/unichar.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
SILE.registerCommand("unichar", function(_, content)
local cp = content[1]
if type(cp) ~= "string" then SU.error("Bad argument to \\unicode") end
SILE.typesetter:typeset(SU.utf8charfromcodepoint(cp))
local hlist = SILE.typesetter.state.nodes
local char = SU.utf8charfromcodepoint(cp)
if #hlist > 1 and hlist[#hlist].is_unshaped then
hlist[#hlist].text = hlist[#hlist].text .. char
else
SILE.typesetter:typeset(char)
end
end)

return { documentation = [[\begin{document}
Expand Down

0 comments on commit 712bc92

Please sign in to comment.