0

enter image description here

I write a document in Lyx (specifically a summary of a course in numerical analysis), and I get the following error when trying to compile my document, using a minted environment for Python code:

FancyVerb error: \end{minted} \

This input will be discarded. Type to continue.

This is the code inside the TeX box:

\begin{minted}[linenos=true, numbersep=5pt, fontsize=\small]{python}
if expression:
    Statements1
else:
    Statements2
\end{minted}

I also add my preamble:

\usepackage{changepage}
\usepackage{multicol}
\usepackage{newtxmath}
\usepackage[bottom]{footmisc}
\usepackage{marginnote}
\usepackage{algorithm,algpseudocode}
\usepackage{color}
\definecolor{scalakeyword}{rgb}{0.16,0.07,0.5}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{aqua}{rgb}{0.9,0.96,0.999}
\definecolor{scalatype}{rgb}{0.2,0.3,0.2}
\definecolor{teal}{rgb}{0,0.6,0}
\definecolor{pythonkeyword}{rgb}{0,0.6,0}
\definecolor{operatorcolor}{rgb}{141,38,165}
\definecolor{newcolor}{RGB}{0.9,0.96,0.999}
\usepackage{listingsutf8}
\usepackage{minted}
\usepackage{shellesc}
\setminted{
    bgcolor=aqua,
}
\setminted{tabsize=4}
\setminted{linenos=true}
\usepackage{ifthenx}
\usepackage{xifthen}
\usepackage{fvextra}

I "consulted" chatgpt about this error, but it couldn't understand what has gone wrong. Maybe you could help me?

I add here the latex code of my document (only the section that prompts the error):

#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\begin_preamble
\usepackage{changepage}
\usepackage{multicol}
\usepackage{newtxmath}
\usepackage[bottom]{footmisc}
\usepackage{marginnote}
\usepackage{algorithm,algpseudocode}
\usepackage{color}
\definecolor{scalakeyword}{rgb}{0.16,0.07,0.5}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{aqua}{rgb}{0.9,0.96,0.999}
\definecolor{scalatype}{rgb}{0.2,0.3,0.2}
\definecolor{teal}{rgb}{0,0.6,0}
\definecolor{pythonkeyword}{rgb}{0,0.6,0}
\definecolor{operatorcolor}{rgb}{141,38,165}
\definecolor{newcolor}{RGB}{0.9,0.96,0.999}
\usepackage{listingsutf8}
\usepackage{minted}
\usepackage{shellesc}
\setminted{
    bgcolor=aqua,
}
\setminted{tabsize=4}
\setminted{linenos=true}
\usepackage{ifthenx}
\usepackage{xifthen}
\usepackage{fvextra}
\end_preamble
\use_default_options true
\begin_modules
eqs-within-sections
figs-within-sections
tabs-within-sections
\end_modules
\maintain_unincluded_children false
\language hebrew
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "Calibri"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts true
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\float_placement H
\paperfontsize 10
\spacing onehalf
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder true
\pdf_colorlinks false
\pdf_backref false
\pdf_pdfusetitle true
\papersize default
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine natbib
\cite_engine_type authoryear
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 1cm
\topmargin 3cm
\rightmargin 1cm
\bottommargin 2cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle fancy
\listings_params "language=Python,basicstyle={\ttfamily},keywordstyle={\bfseries\color[rgb]{0,0.5,0}},stringstyle={\color{red}},commentstyle={\color{gray}},morekeywords={False, class, finally, is, return, None, continue, for, lambda, try, True, def, from, nonlocal, while, and, del, global, not, with, as, elif, if, or, yield, assert, else, import, pass, break, except, in, raise, and, or, not, is, is not, in, not in},backgroundcolor={\color{aqua}}"
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout
...
...
...
...
...
...
\begin_layout Subsection
תזכורת: פייתון
\end_layout

\begin_layout Standard
משום שבקורס זה האלגוריתמים נכתבים בשפת פייתון, נזכיר מספר פונקציות ועקרונות
 חשובים של השפה:
\series bold

\begin_inset Newline newline
\end_inset


\begin_inset Newline newline
\end_inset

בקרת זרימה.

\series default
 ניתן לבצע בקרה על התקדמות הקוד באמצעות משפטי תנאי, הנכתבים תוך שימוש בפקודות
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
if
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
\lang hebrew
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
ו
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
else
\lang hebrew
:
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
begin{minted}[linenos=true, numbersep=5pt, fontsize=
\backslash
small]{python}
\end_layout

\begin_layout Plain Layout

if expression:
\end_layout

\begin_layout Plain Layout

    Statements1
\end_layout

\begin_layout Plain Layout

else:
\end_layout

\begin_layout Plain Layout

    Statements2
\end_layout

\begin_layout Plain Layout


\backslash
end{minted}
\end_layout

\end_inset

 
\begin_inset Newline newline
\end_inset

הביטוי )
\lang english
expression
\lang hebrew
( מימין לפקודת
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
if
\lang hebrew
, מתאר את התנאי שצריך להתקיים, כדי שהתוכנה 
\begin_inset Quotes eld
\end_inset

תיכנס
\begin_inset Quotes erd
\end_inset

 לתוך הבלוק הראשון )המוגדר באמצעות ההזחה.
 שורה
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\numeric on
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
2
\numeric off
( ותבצע את הפעולות שכתובות בו )
\lang english
Statements
\lang hebrew
(.
 כלומר, הכניסה לתוך הבלוק הראשון תתבצע רק אם הערך הבוליאני של הביטוי מימין
 לפקודת
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
if
\lang hebrew
 יהיה
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
True
\lang hebrew
.
 לעומת זאת, כאשר הערך הבוליאני 
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
הזה 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
הינו
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
False
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
\lang hebrew
, 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
התוכנה לא תבצע את הפעולות שכתובות מתחתיו, ותעבור לבלוק השני )שורה
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\numeric on
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
4
\numeric off
(.
\begin_inset Newline newline
\end_inset


\begin_inset Newline newline
\end_inset

חשוב להדגיש ששני התנאים המוגדרים עבור פקודות
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
if
\lang hebrew
 ו
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
else
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
\lang hebrew
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
הם 
\series bold
משלימים
\series default
.
 כלומר, אם התנאי שמימין לפקודת
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
if
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
\lang hebrew
 
\family default
\series bold
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
מתקיים
\series default
, אז התנאי שמוגדר עבור פקודת
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
else
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
\lang hebrew
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
בהכרח 
\series bold
לא מתקיים
\series default
, ולהפך: אם התנאי שמימין לפקודת
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
if
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
\lang hebrew
 
\family default
\series bold
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
לא מתקיים
\series default
, אז התנאי שמוגדר עבור פקודת
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
else
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
\lang hebrew
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
בהכרח 
\series bold
מתקיים
\series default
.
\begin_inset Newline newline
\end_inset


\begin_inset Newline newline
\end_inset

ניתן לקונן מספר פקודות
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
\lang english
if
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\xout off
\uuline off
\uwave off
\noun off
\color none
\lang hebrew
 
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\xout default
\uuline default
\uwave default
\noun default
\color inherit
אחת בתוך השנייה כאשר רוצים לבצע בקרה באמצעות מספר תנאים:
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
begin{minted}[linenos=true, numbersep=5pt, fontsize=
\backslash
small]{python}
\end_layout

\begin_layout Plain Layout

if grade >= 90:
\end_layout

\begin_layout Plain Layout

    print(
\begin_inset Quotes eld
\end_inset

A
\begin_inset Quotes erd
\end_inset

)
\end_layout

\begin_layout Plain Layout

else:
\end_layout

\begin_layout Plain Layout

    if grade >= 80:
\end_layout

\begin_layout Plain Layout

        print(
\begin_inset Quotes eld
\end_inset

B
\begin_inset Quotes erd
\end_inset

)
\end_layout

\begin_layout Plain Layout

    else:
\end_layout

\begin_layout Plain Layout

        if grade >= 70:
\end_layout

\begin_layout Plain Layout

            print(
\begin_inset Quotes eld
\end_inset

C
\begin_inset Quotes erd
\end_inset

)
\end_layout

\begin_layout Plain Layout

        else:
\end_layout

\begin_layout Plain Layout

            if grade >= 60:
\end_layout

\begin_layout Plain Layout

                print(
\begin_inset Quotes eld
\end_inset

D
\begin_inset Quotes erd
\end_inset

)
\end_layout

\begin_layout Plain Layout

            else:
\end_layout

\begin_layout Plain Layout

                print(
\begin_inset Quotes eld
\end_inset

F
\begin_inset Quotes erd
\end_inset

)
\end_layout

\begin_layout Plain Layout


\backslash
end{minted}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
restoregeometry
\end_layout

\end_inset


\end_layout

\end_body
\end_document

The three dots stand for parts in the Latex code that are not relevant to the error (text regarding the course).

8
  • Could you please add the LyX file to the post? Note that a LyX file is a text file, so you can open it with a text editor and paste it here.
    – Udi Fogiel
    May 30, 2023 at 23:40
  • Try to make the file you post here as small as possible without removing the error.
    – Udi Fogiel
    May 30, 2023 at 23:43
  • I added the Lyx file. Thanks for the quick response May 30, 2023 at 23:46
  • A LyX file should start with a line about the version, something of the form #LyX 2.3 created this file. For more info see http://www.lyx.org/ and end with \end_document. Can you post a complete, but minimal file that demonstrate the error?
    – Udi Fogiel
    May 30, 2023 at 23:50
  • I edited it again. thank you! May 30, 2023 at 23:54

1 Answer 1

1

The problem was caused by having some material at the same line of \end{minted}, e.g.,

\begin{minted}

Some code

\end{minted}\\

by removing \\ the error was solved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .