I am stuck with the error message "Extra \endgroup. \begin{document}". The error occurs when I use menukeys package. A short working example is
\documentclass[12pt, oneside]{book}
\usepackage[a4paper, left=.7in, right=.7in, top=.7in, bottom=.6in, footskip=.25in]{geometry}
\usepackage{color, xcolor}
\usepackage[T1]{fontenc}
\usepackage{multirow}
\usepackage{enumitem}
\setlist{noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt,labelindent=1em,labelsep=10pt,leftmargin=*}
\usepackage{listings}
\newcommand{\rfunc}[1]{\lstinline{#1}} %% Short for 'R inline'
\lstset{language=R}
\lstset{ %
backgroundcolor=\color{white},
basicstyle=\small\ttfamily,
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
breaklines=true, % sets automatic line breaking
% captionpos=b, % sets the caption-position to bottom
commentstyle=\color{black}, % comment style
deletekeywords={...}, % if you want to delete keywords from the given language
% escapeinside={%}{)}, % if you want to add LaTeX within your code
% extendedchars=true, % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
frame=single, % adds a frame around the code
keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
% keywordstyle=\color{black}, % keyword style
language=R, % the language of the code
% otherkeywords={*,...}, % if you want to add more keywords to the set
numbers=left, % where to put the line-numbers; possible values are (none, left, right)
% numbersep=5pt, % how far the line-numbers are from the code
% numberstyle=\tiny\color{mygray},% the style that is used for the line-numbers
rulecolor=\color{black},
% showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
showstringspaces=false, % underline spaces within strings only
% showtabs=false, % show tabs within strings adding particular underscores
% stepnumber=2, % the step between two line-numbers. If it's 1, each line will be numbered
stringstyle=\color{black}, % string literal style
tabsize=2 % sets default tabsize to 2 spaces
}
\usepackage[os=win]{menukeys}
\renewmenumacro{\directory}{pathswithfolder}
\begin{document}
The use of \rfunc{panel} defines how different groups will be represented on the graph. When say \texttt{xyplot(y$\sim$x|z)} is entered on R console, R execute: \texttt{xyplot(y$\sim$x|z, panel=penal.xyplot)}, where \rfunc{panel.xyplot} is the default panel function. The \rfunc{lattice} package contains a number of predefined function that can call the other panel function, depending on the argument used.
\begin{lstlisting}
> xyplot(mpg ~ wt | factor(vs, levels = c(0, 1),
- labels = c("vs = 0", "vs = 1")), data = mtcars,
- type = c("p"), pch = 19,
- panel = function( ... ){
panel.xyplot( ... )
panel.grid(... , h = -1, v = -1)
panel.loess( ... )} )
\end{lstlisting}
\end{document}
The screenshot after manually installing and updating the package through MikeConsole is

menukeysupdate in MikTeX landed on my machine a few moments ago. Depending on your mirror you may have to wait another few hours (up to a day) to get the update. (Make sure you don't have a manual installation ofmenukeysabout and that you only have it installed via the MikTeX Console.) – moewe Nov 04 '20 at 05:57.logfile of the run? (If the.logfile is too long, upload it to a text-sharing site such as https://pastebin.com/ or https://gist.github.com/) – moewe Nov 04 '20 at 06:42! Extra }, or forgotten \endgroup. \egroup
l.610 + type = c("p"), pch = 19, I've deleted a group-closing symbol because it seems to be spurious, as in
– itfeature.com Nov 04 '20 at 16:52$x}$'. But perhaps the } is legitimate and you forgot something else, as in\hbox{$x}'. In such cases the way to recover is to insert both the forgotten and the deleted material, e.g., by typing `I$}'..logfile of the non-working document to https://pastebin.com/ or https://gist.github.com/? If you deleted all temporary files and still get the error, the error might be related to code you haven't shown us. – moewe Nov 04 '20 at 16:56.logfile. It shows that yourmenukeyspackage is fully up to date. But since the document where the problem occurs is much longer than the MWE shown in the question, the problem might be with code you haven't shown us so far. You will have to minimise the try and isolate the problematic code an crate a real MWE that reproduces the error. I'm afraid there is nothing more I could do at this point, sorry. – moewe Nov 04 '20 at 17:13\rfuncis a bad idea, you should instead use\newcommand\rfunc{\lstinline}(don't grab the argument for\lstinline, let it grab it itself). That being said, your current MWE still doesn't throw an error for me. – Skillmon Jun 09 '22 at 13:59