# Attempt to call a nil value (field 'check_version') when working with gregorio

I am not an expert with Latex at all and I am just happy to be able to use it — to some extent. After quite some time, I decided to continue working with it and I saw that all my Gregorian chants do not compile anymore. The following error message is shown:

(./gregoriotex.tex[\directlua]:1: attempt to call a nil value (field 'check_version')
stack traceback:
[\directlua]:1: in main chunk.
l.63 ...x.check_version(\number\greinternalversion)}


I am using MiKTeX Console V. 2.9.7206 and made all updates on Dec/18 2019. The Gregorio package I am using is V.5.2.1.

this is my Code around the Gregorio TeX file:

% !TEX TS-program = lualatex
% !TEX encoding = UTF-8
\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{a4paper}
\geometry{left=1cm, right=1cm, top=1cm, bottom=1cm}
\usepackage{gregoriotex}
\begin{document}
\begin{center}\begin{huge}\textsc{Credo}\end{huge}\end{center}
\setspaceafterinitial{2.2mm plus 0em minus 0em}
\setspacebeforeinitial{2.2mm plus 0em minus 0em}
\def\greinitialformat#1{{\fontsize{43}{43}\selectfont #1}}
\redlines
\gresetfirstlineaboveinitial{\small \textsc{\textbf{III.}}}{\small \textsc\textbf{III.}}
\commentary{{\small \emph{XVII. s.}}}
\definecolor{Red}{rgb}{0.9,0.3,0.3}
\definecolor{Black}{rgb}{0.0,0.0,0.0}
\includescore{CredoIII.tex}
\end{document}



I'm not sure if it really makes sense to paste the whole GABC file here. Instead I uploaded the file to pastebin: https://pastebin.com/UBKfuhT3 If i should still paste it here, I can do, of course...

I already looked for this issue here and elsewhere and I found some references to microtype (e.g. microtype error with lualatex: "attempt to call field warning a nil value"), but I cannot figure out if or how this relates to my issue or how I could use it to solve my issue…

Can anyone help?

• Show a minimal example that can be used for tests. Dec 16, 2019 at 22:46
• It would be important to know which version you’re trying to work with now. I have a .gabc file from 2012 that still works (and can insert it as an example for your question if you like), but I had to make some changes to the .tex file where I include the score. Dec 16, 2019 at 22:51
• github.com/gregorio-project/gregorio/blob/master/CHANGELOG.md should be useful. Dec 17, 2019 at 0:29
• I added the surrounding TeX. If you also need the Gregorio part, please let me know.
– TomS
Dec 18, 2019 at 7:35

This should work:

\documentclass[12pt]{article}
\usepackage{fontspec,graphicx,gregoriotex}
\usepackage[a4paper,left=1cm,right=1cm,top=1cm,bottom=1cm]{geometry}
\definecolor{Red}{rgb}{0.9,0.3,0.3}
\definecolor{Black}{rgb}{0.0,0.0,0.0}
\usepackage{microtype}
\begin{document}
\begin{center}
\huge\scshape Credo
\end{center}
\grechangedim{beforeinitialshift}{2.2mm}{scalable}
\grechangedim{afterinitialshift}{2.2mm}{scalable}
\grechangestyle{initial}{\fontsize{43}{43}\selectfont}
\gresetlinecolor{gregoriocolor}% red lines
\greannotation{\small\textsc{iii}}
\gresetheadercapture{commentary}{grecommentary}{string}% string is taken from .gabc file
\gregorioscore{CredoIII.gtex}% include file produced by running gregorio on .gabc file
\end{document}


The commentary line needs to be moved to the .gabc file.

Here is the output with \setmainfont{EB Garamond}, and with commentary: XVII. s.; added to your .gabc file:

N.B.: The above works with the version of gregorio now in TeX Live. If you have an old version in your present working directory, you may well see numerous and opaque error messages.

• Nope, does not work... unfortunately. This is the message: (C:/Users/xxxxx/AppData/Roaming/MiKTeX/2.9/tex/luatex/ctablestack/ctable stack.sty))[\directlua]:1: attempt to call a nil value (field 'check_version') stack traceback: [\directlua]:1: in main chunk. l.63 ...x.check_version(\number\greinternalversion)}
– TomS
Dec 18, 2019 at 16:36
• Then, unless there’s something wrong in your .gabc file, I’m afraid I can’t help, because it works for me with my .gabc files. I’m using TeX Live, not MikTeX; that may also account for our different results. Dec 18, 2019 at 16:40
• If you post your .gabc file, I’ll test it later today; that may tell us whether this is a TeX Live vs. MikTeX problem. Dec 18, 2019 at 16:48
• Your .gabc file produces perfect output for me, so this looks like a problem peculiar to MikTeX. Very sorry, I can be of no use there, since I haven’t touched Microsoft in some twenty years. Does it work for you if you comment out \usepackage{microtype}? Dec 18, 2019 at 21:59
• Do you perhaps have more than one version of gregorio on your system? Dec 19, 2019 at 0:39