# How to use LuaTeX append_to_vlist_filter callback

I am considering a solution to the automatic grid typesetting problem though LuaTeX callbacks. The most relevant one seems to be append_to_vlist_filter. (vpack can also work, I support, but a less elegant solution)

However, it seems that it does work properly. The documents is quite vague on its return value.

function(<node> box, <string> locationcode, <number prevdepth>, <boolean> mirrored)
return list, prevdepth
end


It is ok to return nothing in which case you also need to flush the box or deal with it yourself. The prevdepth is also optional. Locations are box, alignment, equation, equation_number and post_linebreak

Below is a minimal example,

\documentclass{article}

\directlua{
end
}

\begin{document}
Test
\end{document}


I assumed that the return value list means the head of a node list. In the simple example, the original box is returned as the head of a single node list. Yet, when compiled there's no page output.

What does the document mean by flush the box or deal with it yourself?

• ltj-direction.lua from the luatexja package has an example of the use of this callback. – Ulrike Fischer Mar 11 '17 at 17:19

I'd found the same example as Ulrike in luatexja, and so I think the identity function is something like

\documentclass{article}

\directlua{
return nil
end
}

\begin{document}
Test
\end{document}


which typesets Test and echoes

adding userdata in context post_linebreak