0

I'm trying to write a list in an enumerate environment, but for some reason even if the code is (apparently) correct, Latex gives me the following error at the second line: "! LaTeX Error: Something's wrong--perhaps a missing \item."

Point is, this the code;

\begin{enumerate}
    \item La soluzione per $\theta$ da' la conferma che il moto si svolge su un piano;
    \item La soluzione per $\phi$ restituisce la conservazione della velocità aerolare;
    \item La soluzione per r è la nota equazione dell'ellisse.
\end{enumerate}

And it follows the rules that I've seen on basically every LaTeX manuals on the internet, this "missing \item" is clearly there. I also have already the \usepackage{enumitem} activated, I'd say is also pretty standard. Someone might say that I could just skip it, the problem is that if I compile the code, this is the only error I get; If I delete this whole part of the code, the same error shows up on the following "itemize" or "enumerate" environment and so on, and that basically would mean that I should get ride of every list of the document to make it work, which is not exactly doable in a thesis. Maybe the solution is pretty dumb, but really I can't wrap my head around it. Thank you in advance.

EDIT: Ok, following your advices I tried to find the specific lines that are the sources of the problem and this is what I got

\begin{figure}[h]
\includegraphics[scale=0.5]{Potenziale.png} 
\caption{potenziale}
\flushleft
\end{figure}
\clearpage
\newpage
\begin{enumerate}
    \item La soluzione per $\theta$ da' la conferma che il moto si svolge su un piano;
    \item La soluzione per $\phi$ restituisce la conservazione della velocità aerolare;
    \item La soluzione per r è la nota equazione dell'ellisse.
\end{enumerate}
\end{document}

Normally, between the \newpage command and the part that I wrote before there are something like 200 lines of code. Clearly you don't have the source image so I suppose the code can't be ported somewhere else, but this is the situation. I tried to delete the image linked and it works; I can go on without the pic anyway, so at least the problem is solved (though i'm still curious why an image in a totally different part of the document would resulte in a "missing \item" )

7
  • I composed a working example with your code (follow the link: ix.io/2Est) . Please compose one with the error you get. – gigiair Nov 17 '20 at 11:19
  • 1
    My cloudy crystal ball says you are doing something that redefined the enumerate environment to take an argument. Also, carefully check the line number given in the error message! – Donald Arseneau Nov 17 '20 at 12:00
  • 1
    There is no point in posting a working fragment and asking about an error in code you have not posted. Please edit the question so the example is a complete small document that shows the error. – David Carlisle Nov 17 '20 at 12:38
  • 1
    start from a copy of your document, delete everything after the enumerate, delete everything before the enumerate that you can delete while still showing the error, the delete any \usepackage not used in the resulting small example, and post the resulting document here. Then someone can debug the error. – David Carlisle Nov 17 '20 at 12:40
  • 1
    @barbarabeeton Somehow it has to do with the stray \flushleft at the end of the figure environment, but I cannot really understand how exactly the error originates. – campa Nov 17 '20 at 14:53
1

The \flushleft is an error, because it is actually an artifact of the flushleft environment, which encloses ragged-right text set off from the running text with vertical spaces (at begin and end). If you want a command version, the command is \raggedright. (I presume it should go before the \includegraphics.)

How does it interact with \item? The flushleft definition uses a "trivial list" to get the vertical spacing of lists.

(This answer comes after the question was editied with revealing information.)

1
  • @DavidCarlisle Should \@trivlist really assign \@newlisttrue globally but \@item sets \everypar locally to undo the setting.. – Donald Arseneau Nov 18 '20 at 6:04
0

This works with me. (I changed the accents though)

\documentclass{report}
\begin{document}
\begin{enumerate}
\item La soluzione per $\theta$ da' la conferma che il moto si svolge su un piano;
\item La soluzione per $\phi$ restituisce la conservazione della velocit\`a aerolare;
\item La soluzione per r \`e la nota equazione dell'ellisse.
\end{enumerate}
\end{document}

in "standalone":

\documentclass{standalone}
\begin{document}
    \begin{minipage}{12cm}
        \begin{enumerate}
            \item La soluzione per $\theta$ da' la conferma che il moto si svolge su un piano;
            \item La soluzione per $\phi$ restituisce la conservazione della velocit\`a aerolare;
            \item La soluzione per r \`e la nota equazione dell'ellisse.
        \end{enumerate}
    \end{minipage}
\end{document}
7
  • Forgot to mention it, the code worked just fine when I copied it and paste in a new tex file. This would normally lead to believe that the problem lies somewhere else, possibly right before/after the environment, but if that would be the case, then it would be an isolated mistake; instead, as I said before, if I delete totally this part of the code, the same error shows up on the next itemize/enumerate environment and so on. For reference, in the original document there's just a line of introduction before the posted code and there's nothign after (just the beginning of a new section). – NioA Nov 17 '20 at 11:24
  • What documentclass are you using? – Michel Janssens Nov 17 '20 at 11:25
  • Article. This piece of code comes from a thesis for a bachelor – NioA Nov 17 '20 at 11:27
  • There it should work as well. In e.g. standalone, this will not work. Can you post the (minimal) document that fails? In those document classes you can use it but you have to place it in a minipage (so that \LaTeX\ knows the width of the text). I will add it to the answer. – Michel Janssens Nov 17 '20 at 11:33
  • Well, I have no idea on how to do this. The entire document have more than 900 lines of code and the lines that cause the error are the one that I wrote before and as you have seen, copying and pasting single lines doesn't show any error at all. – NioA Nov 17 '20 at 11:37

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.