Following up this answer, I would like to know why the following doesn't compile and gives this error

! Undefined control sequence. \tcb@startbox ...x }{\tcb@w@upper }\tcb@lua@color {tcbcolupper}\kvtcb@fontup...


\newcommand{\exProgram}{3\textsuperscript{rd} Year}

        raster multicolumn = 3
            raster force size=false,
            raster columns=2,
            raster equal skip = 0mm,
            \tcbitem[add to width = 2cm, halign = left,]
            University\\ Faculty\\
            \tcbitem[add to width =-2cm, halign = right]  \includegraphics[height=20 mm]{example-image}
    \begin{tcolorbox}[before upper*=\centering]
        Course Code: \textbf{\CourseCode}
        before upper*=\centering, equal height group=A,
        interior engine = standard,
        colback = gray,
        raster multicolumn = 3,
        top = 5pt, bottom = 5pt
        before upper*=\centering,
        equal height group=A,
        raster multicolumn = 3,
        This exam contains

            raster columns=3, raster rows=3,
            raster equal height = rows,
            raster every box/.style={minimum for current equal height group = 8 mm},
            raster equal skip = 0mm,
            top = 0mm, bottom = 0mm,



top = 0mm,
headheight = \headerTotalHeight,

  • 1
    you shouldn't look only at the error as presented by your editor (texstudio?), they often shorten it and don't show the actual undefined command. – Ulrike Fischer Nov 28 '20 at 10:01
  • @UlrikeFischer Thanks for the hint. I remember you previously told me about some package or way to quote the errors but I don't remember it now. – Diaa Nov 28 '20 at 12:43

You should never measure things in the preamble. Font settings might be delayed at begin document.

Do the setting at the right place:


Now, if you want to know why this used to run but now fails? A change in tcolorbox.sty, aimed at exploiting LuaTeX color management if available, has been introduced. This requires defining \tcb@lua@color in a suitable way and the package author chose to do it at begin document.

This means that the meaning of \tcb@lua@color is not yet available in the document preamble, whence the error.

  • Now, it works, but the header is printed above the paper top border. What should be done to make it printed as expected just below the paper top border? – Diaa Nov 28 '20 at 12:42
  • So, I think \headerTotalHeight was passed to geometry too late. – Diaa Nov 28 '20 at 14:43
  • 1
    add \geometry{headheight = \headerTotalHeight} to the \AtBeginDocument command. – Ulrike Fischer Nov 30 '20 at 17:16
  • @UlrikeFischer I would be grateful if you could provide me with a full-code answer to make sure I do it right. – Diaa Dec 1 '20 at 0:09
  • If I would like to have the following \newlength{\headerTotalHeight} \AtBeginDocument{\settototalheight\headerTotalHeight{\headerContents}\geometry{headheight = \headerTotalHeight}} inside the \ExplSyntax code of this question, what should be done? – Diaa Dec 2 '20 at 23:10

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.