1

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

enter image description here Need guidance.

  • 2
    menukeys was updated in the last few days, if you update your tex system the error will go. – David Carlisle Nov 03 '20 at 18:56
  • Thank you.I reinstalled the latest versions of mektex and editor but error exists. – itfeature.com Nov 03 '20 at 20:04
  • 1
    it is on ctan and in texlive for a couple of days but apparently not in miktex yet Ulrike tells me. You could get it from ctan or wait for the miktex update – David Carlisle Nov 03 '20 at 20:53
  • 1
    miktex doesn't have the update yet. You will have to wait until it is there or install manually from ctan. – Ulrike Fischer Nov 03 '20 at 20:53
  • After updating manually and through MikTex console, I am getting this error "Extra }, or forgotten \endgroup. +" – itfeature.com Nov 04 '20 at 05:16
  • 1
    The menukeys update 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 of menukeys about and that you only have it installed via the MikTeX Console.) – moewe Nov 04 '20 at 05:57
  • @moewe: I got update on my machine and followed it. – itfeature.com Nov 04 '20 at 06:11
  • 2
    Do you still get the error with the MWE you posted after the update? On my fully updated MikTeX machine I can run your MWE without a problem. Can you please run your MWE in a new, empty folder and upload the complete .log file of the run? (If the .log file 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
  • @moewe: for the above code, I am not getting any error. However, when I compile my actual LaTex file, I get the same error as discussed above. When I omit the R code then file compiles well without any error. – itfeature.com Nov 04 '20 at 08:01
  • Can you show us a short example document that does reproduce the error? If the code shown in the question compiles fine for you, the problem might be something else entirely, but we can only help you find out where the issue might be if we get to see code that reproduces the problem. – moewe Nov 04 '20 at 11:46
  • @moewe: I have updated the working example. When I run it in a new file, I get no error. However, when I run it all in the existing file I get the error message. I cleaned the log, aux, and other files too. When I exclude the "lstlisting" block or the text above it, everything compiles well. – itfeature.com Nov 04 '20 at 16:50
  • The error message in the log is

    ! 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 $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$}'.

    – itfeature.com Nov 04 '20 at 16:52
  • Can you please post the full .log file 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
  • @moewe: the full log file link is https://gist.github.com/itfeature/d63305621d6dfd22c76f6231da7bbd09 – itfeature.com Nov 04 '20 at 17:06
  • 1
    Thanks for that .log file. It shows that your menukeys package 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
  • @moewe: Thanks for all. I shared the problem after tracing the prolematic area of the full document. It is strange for me that when I omit the lstlisting block or the text above the lstlisting block, I get no error message. Thank you again. – itfeature.com Nov 04 '20 at 17:19
  • 1
    @itfeature.com Sorry, I'm really late to the party, but the definition of \rfunc is 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
  • @Skillmon Thank you. got it. – itfeature.com Apr 30 '23 at 06:50

0 Answers0