The \par option stopped working in lualatex in 2019.

tex.print(-2,x .. "\\par") produces only \par in the final text, no paragraph break.

File.txt may be any text file with ^ and & to mark the beginning and end of the selected text.

It used to work in MacTex2018



function readtxt()
file = io.open("File.txt", "r")
text = file:read("*all")
for x in string.gmatch(text, "^(.-)&") do
tex.print(-2,x .. "\\par")


  • What do you think the -2 in tex.print does? – Henri Menke Aug 19 '19 at 21:47
  • 2
    You will want to use tex.sprint(-2,x) tex.sprint("\\par"). – Henri Menke Aug 19 '19 at 21:49
  • 2
    it is not needed to load luaotfload, luatextra and luainputenc nowadays. – Ulrike Fischer Aug 19 '19 at 21:52
  • Many thanks, it is all working again. 1. Having no \usepackage{luacode,luatextra,luaotfload} did not work on Mactex_2019 with Lualatex, still had to include it. The rest worked out. I have found no information on the -2 option in the manuals. Any help? – Dmitry Starostin Aug 19 '19 at 22:28
  • 1
    @DmitryStarostin Quote: “The optional parameter can be used to print the strings using the catcode regime defined by \catcodetable n. If n is -1, the currently active catcode regime is used. If n is -2, the resulting catcodes are the result of \the\toks: all category codes are 12 (other) except for the space character, that has category code 10 (space).” Your \par output by tex.print(-2, ... "\\par") was made of four character tokens of category 12 (other). This is not the \par control sequence token. – frougon Aug 19 '19 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.