langcog / experimentology

Experimentology textbook
https://langcog.github.io/experimentology/
Other
42 stars 18 forks source link

error rendering PDF #196

Closed poldrack closed 1 year ago

poldrack commented 1 year ago

When I try to render the pdf (using the default _quarto.yml) I get the following error:

Error running filter /home/poldrack/Dropbox/code/quarto-cli/src/resources/filters/main.lua:
...e/experimentology/_extensions/pandoc-ext/boxes/boxes.lua:35: bad argument #1 to 'insert' (table expected, got Block)
stack traceback:
    ...e/experimentology/_extensions/pandoc-ext/boxes/boxes.lua:35: in function <...e/experimentology/_extensions/pandoc-ext/boxes/boxes.lua:32>
    (...tail calls...)
    ...e/quarto-cli/src/resources/filters/./ast/customnodes.lua:139: in function <...e/quarto-cli/src/resources/filters/./ast/customnodes.lua:129>
    (...tail calls...)
    [C]: in ?
    [C]: in method 'walk'
    ...e/quarto-cli/src/resources/filters/./ast/customnodes.lua:61: in function <...e/quarto-cli/src/resources/filters/./ast/customnodes.lua:51>
    (...tail calls...)
    .../quarto-cli/src/resources/filters/./ast/runemulation.lua:36: in local 'callback'
    [string "..."]:1883: in field 'withScriptFile'
    .../quarto-cli/src/resources/filters/./ast/runemulation.lua:47: in upvalue 'run_emulated_filter_chain'
    .../quarto-cli/src/resources/filters/./ast/runemulation.lua:84: in function <.../quarto-cli/src/resources/filters/./ast/runemulation.lua:81>
stack traceback:
    ...e/quarto-cli/src/resources/filters/./ast/customnodes.lua:61: in function <...e/quarto-cli/src/resources/filters/./ast/customnodes.lua:51>
    (...tail calls...)
    .../quarto-cli/src/resources/filters/./ast/runemulation.lua:36: in local 'callback'
    [string "..."]:1883: in field 'withScriptFile'
    .../quarto-cli/src/resources/filters/./ast/runemulation.lua:47: in upvalue 'run_emulated_filter_chain'
    .../quarto-cli/src/resources/filters/./ast/runemulation.lua:84: in function <.../quarto-cli/src/resources/filters/./ast/runemulation.lua:81>
ERROR: Error
    at Object.onComplete (file:///home/poldrack/Dropbox/code/quarto-cli/src/project/types/book/book-render.ts:317:15)
    at eventLoopTick (ext:core/01_core.js:181:11)
    at async renderFiles (file:///home/poldrack/Dropbox/code/quarto-cli/src/command/render/render-files.ts:330:12)
    at async renderProject (file:///home/poldrack/Dropbox/code/quarto-cli/src/command/render/project.ts:266:23)
    at async Command.fn (file:///home/poldrack/Dropbox/code/quarto-cli/src/command/render/cmd.ts:212:26)
    at async Command.execute (file:///home/poldrack/Dropbox/code/quarto-cli/src/vendor/deno.land/x/cliffy@v0.25.4/command/command.ts:1790:7)
    at async quarto (file:///home/poldrack/Dropbox/code/quarto-cli/src/quarto.ts:135:3)
    at async file:///home/poldrack/Dropbox/code/quarto-cli/src/quarto.ts:167:5
make: *** [Makefile:6: render-ug] Error 1

This is the relevant section in boxes.lua:

-- wrap element in \begin{env}[opts] and \end{env}
local function wrapEnv(el, env, opts)
  local beginEnv = pandoc.RawInline('latex', '\\begin{' .. env .. '}[' .. opts .. ']\n')
  local endEnv = pandoc.RawInline('latex', '\\end{' .. env .. '}\n')
  table.insert(el, 1, beginEnv)
  table.insert(el, endEnv)
  return el
end

I'm not familiar with the pandoc extensions so I'm not quite sure how to debug this, but I wonder if I have a different version of pandoc such that pandoc.RawInline is returning a Block rather than a table? (I'm using pandoc 2.9.2.1 on Linux).

mikabr commented 1 year ago

A different pandoc version seems like a plausible explanation for the error -- I'm running pandoc 3.1.5.

poldrack commented 1 year ago

upgrading to the latest pandoc (3.1.8) didn't solve the problem. where does _extensions/pandoc-ext/boxes/ come from? I don't see it in the pandoc extensions (https://github.com/pandoc-ext), was hoping to check there for issues.

poldrack commented 1 year ago

(sorry for accidentally closing :-)

mikabr commented 1 year ago

It's a custom extension that we wrote, so unfortunately you won't find any helpful information anywhere :P Another difference could be the version of quarto you're running? I'm on 1.3.433.

poldrack commented 1 year ago

ok, confirmed that the the error with block.lua does not occur using 1.3.433 on Linux; the problem seems to be with the more recent development version. I'm still having trouble rendering the pdf due to latex compliation issues, but I"ll close this issue and open another if I can't figure that out.