The solution
Delete all files except.tex, and run it again. It’s ok!!
Tag Archives: Latex
LaTeX Error: There’s no line here to end
\end{lstlisting} don’t add a newline after it!! \
LaTeX Error: Can be used only in preamble
LaTeX Error: Can be used only in preamble
translation: Xovee
translation time: June 11, 2020
LaTeX Error: Can be used only in preamble
This error occurs if you introduce a package or class in the body of the text, rather than in the preamble. Before the command \begin{document}, everything is called a prologue. In the prologue, you define the type of document, the language of the document, and many basic Settings. For example, the preface to a general document looks something like this:
\documentclass[12pt, letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\title{First document}
\author{Hubert Farnsworth \thanks{funded by the ShareLaTeX team}}
\date{February 2014}
If you introduce the package in the body (after \begin{document}) instead of in the preface, you will get this error:
To resolve this error, you must ensure that all packages introduce the command \usepackage{… }, and \ documentClass []{… }, before the \begin{document} command. If you want to learn more about LaTeX document structure, please refer to this document.
Solve the problem: Something’s wrong–perhaps a missing \item. \end{thebibliography}
Something’s wrong–perhaps a missing \item. \end{thebibliography}
The same latex documents are fine to compile in Windows but not on MAC.
The underlying problem is the *.bbL file in the directory where *.tex resides. This file is handled differently on Windows and MAC. When there are no references in the article, Windows compiles, but MAC does not.
So here’s the solution:
(1) First close *.tex file, and then delete *.bbL file;
(2) Open *.tex file and add the statement \ {*} anywhere in the article;
(3) Compile again, there is no problem.
[latex] latex adjust row spacing
we usually use two kinds of units to adjust the line spacing in word, one is single spacing , 1.5 times spacing, 2 times spacing, etc., and the other is USES “pounds” for setting, I generally do not like to use single spacing when writing documents, I think the 22 pound spacing is the most appropriate, looks the most comfortable.
today when I was editing my paper with latex, I wanted to adjust the line spacing in the LLNCS template, so I summarized both approaches, but before I could use them, I had to introduce the package file: \usepackage{setspace} :
1) \ renewcommand {\ baselinestretch} {1.0} strong> span>
span> p>
can be understood as what I just used in word, one is to adjust the single spacing, 1.5 times the spacing, 2 times the spacing, etc..
2) \ setlength {\ baselineskip} {20 pt} strong> span> span> p>
First of all, we need to know several common unit conversions of LaTeX:
We often see the units of length used by LaTeX, in, em, and so on.
LaTeX
span> span> span> p>
- – in inches (inch) span> span> span> span> li>
- mm mm (millimeters) span> span> li>
- “ cm (centimeters) span> span> li>
em- span>- pt points (approximately 1/72 inch)
- 0 1 ex – 2 Approximately the height of an “x” in the current font
- mm mm (millimeters) span> span> li>
length can also be negative, such as
span> span>
and “pounds” is a measure of the size of a print, which is about one seventy-two inches. While
so this can be roughly equal to the “pounds” in wor units.
Latex subsection cannot wrap and indent
solution: the line under the heading: \ + Spaces; The next line: \newline; The next line: \indent + body.
p>
example:
p>
p>