我正在使用 Overleaf,因为这是学校推荐的程序和一个仅用于列表的基本模板。
我使用标准逐项列表一切顺利,突然我的第四个条目决定不缩进。我四处寻找,改为枚举并上传正确的包\usepackage{enumitem}
。但现在,在我插入网站后,第六个条目将所有文本更改为没有空格的斜体。我正在尝试寻找一个不涉及数学方程式的解决方法,但我一无所获。代码如下:
\documentclass{article}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage[utf8]{inputenc}
\section{\textbf {Information Sites and Tools}}
\begin{enumerate}
\noindent
{\textbf {"LaTeX For Beginners Handbook"}}. Created by the Information Services Department of the University of Edinburgh: http://www.docs.is.ed.ac.uk/skills/documents/3722/3722-2014.pdf
\newline
\newline
{\textbf {CTAN (Comprehensive TeX Archive Network)}}. A free source of packages available for download that can be used inside LaTeX documents: https://ctan.org/pkg/aurical
\\
\\
{\textbf {TeX Stack Exchange}} A forum website for LaTeX, TeX, and other typesetting systems free for sign up and browsing. There are many veteran users here and are very helpful: https://tex.stackexchange.com/
\\
\\
{\textbf {Tables Generator}} A free table-generating website that allows users to generate tables for LaTeX, HTML, or other sources including the source code that can be inserted into any LaTeX document. It has some basic and limited formatting options. It was created using many pieces open-source software: https://www.tablesgenerator.com/
\\
\\
{\textbf {"Macros".}} This document was created by Andrew Török of the University of Houston Math Department. A brief and easy to understand introduction and explanation of macros and how to create them: https://www.math.uh.edu/~torok/math_6298/latex/macros.html
\\
\\
{\textbf {"LaTeX Command Glossary".}} A list of common LaTeX commands provided by Wikibooks:
https://en.wikibooks.org/wiki/LaTeX/Command_Glossary
最后一条是全部斜体,单词之间没有空格。任何帮助都将不胜感激。
答案1
渴望评论:
- 您提供的代码不完整,并且有很多错误(请参阅我在问题下方的评论)。因此,我们无法重现您的问题。因此,我恳请您更正提供的代码以完成小文档,从而重现您的问题。在此,请考虑我在问题下方的评论。
- 不要用
\newline
或来结束列表中的项目\\
。它们只会使列表格式变得混乱。 - 不要在
section
标题内格式化部分样式。 - 对于链接,您需要使用用于超引用的包之一:
url
,或其扩展xurl
或hyperref
(˙url
也包含)。 - 目前还不清楚您想要什么样的列表布局。下面在 MWE 中使用默认设置。如果您想更改它,软件包
enumitem
提供了许多可能性。例如,看看如果您使用 开始列表会发生什么\begin{enumerate}[leftmargin=*]
。
首先看看以下 MWE(最小工作示例)是否能提供您想要获得的内容:
\documentclass{article}
\usepackage{fullpage}
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage{xurl}
\begin{document}
\section{Information Sites and Tools}
\begin{enumerate}
\item \textbf{"LaTeX For Beginners Handbook"}.
Created by the Information Services Department of the University of Edinburgh:
\url{http://www.docs.is.ed.ac.uk/skills/documents/3722/3722-2014.pdf}
\item \textbf{CTAN (Comprehensive TeX Archive Network)}.
A free source of packages available for download that can be used inside LaTeX
documents: \url{https://ctan.org/pkg/aurical}
\item \textbf {TeX Stack Exchange}
A forum website for LaTeX, TeX, and other typesetting systems free
for sign up and browsing. There are many veteran users here and are very
helpful: \url{https://tex.stackexchange.com/}
\item \textbf {Tables Generator}
A free table-generating website that allows users to generate
tables for LaTeX, HTML, or other sources including the source code that can
be inserted into any LaTeX document. It has some basic and limited formatting
options. It was created using many pieces open-source software:
\url{https://www.tablesgenerator.com/}
\item \textbf {"Macros".}
This document was created by Andrew Török of the University of Houston Math
Department. A brief and easy to understand introduction and explanation of
macros and how to create them:
\url{https://www.math.uh.edu/~torok/math_6298/latex/macros.html}
\item \textbf{"LaTeX Command Glossary".}
A list of common LaTeX commands provided by Wikibooks: \url{https://en.wikibooks.org/wiki/LaTeX/Command_Glossary}
\end{enumerate}
\end{document}
答案2
作为附录Zarko 的回答:
如果我拿来你的代码,添加\begin{document}
和\end{document}
并尝试编译它,正如预期的那样,我会收到多条错误消息。一旦您的编译过程导致错误消息,请不要查看输出,而是先修复它们。这一点尤其重要,因为 TeX 只会在发生错误后尝试恢复足够的文件以进行语法检查,而不会在发生错误后尝试生成合理的输出。因此,即使您得到的东西乍一看像 pdf 文件,它仍然可能存在问题。
点击带有红色矩形框和数字的按钮,可以查看错误消息。只要有红色矩形框,就会出现错误消息。
我们来看看错误信息:
! Missing $ inserted. l.25 ...them: https://www.math.uh.edu/~torok/math_
由于 url 包含 ,因此您会收到此错误消息_
。由于您无法_
在普通文本中使用 ,LaTeX 假设您实际上想要使用数学模式。(_
在那里,您可以使用 来表示下标,例如$x_{y}$
)由于您在这种情况下不想使用任何数学运算,但想要显示 url,请加载包xurl
并将 url 放在\url
命令内。对文档中的所有其他 url 重复此操作。
完成上述更改后,LaTeX 现在抱怨缺少\end{enumerate}
,所以让我们在 之前添加此行\end{document}
。
添加此行后,我们仍然收到错误消息:
Something's wrong--perhaps a missing \item.
这是因为 latex 期望输入枚举列表的项目采用以下通用格式:
\begin{enumerate}
\item text that belongs to the first item
\item text that belongs to the second item
\end{enumerate}
将此一般方案与您的代码进行比较,发现您从未使用过该\item
命令。为了更正您enumerate
环境中的语法,请\item
在每个命令之前放置\textbf...
并删除所有出现的\\ \\
和,\newline
因为这里不需要它们。
完成所有这些更改后,我们最终得到了一个代码,该代码最终编译时没有任何错误消息:
\documentclass{article}
\usepackage{fullpage}
%\usepackage{graphicx} % not related to this example
%\usepackage{xcolor} % not related to this example
%\usepackage{fancyhdr} % not related to this example
%\usepackage{enumitem} % not needed for the default enumerate environment
%\usepackage[utf8]{inputenc} % default in an up to date installation
\usepackage{xurl}
\begin{document}
\section{Information Sites and Tools}
\begin{enumerate}
\item \textbf {"LaTeX For Beginners Handbook"}. Created by the Information Services Department of the University of Edinburgh: \url{http://www.docs.is.ed.ac.uk/skills/documents/3722/3722-2014.pdf }
\item \textbf {CTAN (Comprehensive TeX Archive Network)}. A free source of packages available for download that can be used inside LaTeX documents: \url{https://ctan.org/pkg/aurical}
\item \textbf {TeX Stack Exchange} A forum website for LaTeX, TeX, and other typesetting systems free for sign up and browsing. There are many veteran users here and are very helpful: \url{https://tex.stackexchange.com/}
\item \textbf {Tables Generator} A free table-generating website that allows users to generate tables for LaTeX, HTML, or other sources including the source code that can be inserted into any LaTeX document. It has some basic and limited formatting options. It was created using many pieces open-source software: \url{https://www.tablesgenerator.com/}
\item \textbf {"Macros".} This document was created by Andrew Török of the University of Houston Math Department. A brief and easy to understand introduction and explanation of macros and how to create them: \url{https://www.math.uh.edu/~torok/math_6298/latex/macros.html}
\item \textbf {"LaTeX Command Glossary".} A list of common LaTeX commands provided by Wikibooks:
\url{https://en.wikibooks.org/wiki/LaTeX/Command_Glossary}
\end{enumerate}
\end{document}
最后,让我们看一下输出。你在所有项目中使用,并在问题中\textbf
提到尝试过,这让我猜想,你实际上可能对未编号的描述式列表感兴趣。如果是这种情况,你可以使用代替和等代替。如果你还希望更改网址的字体以匹配通常的文本字体,你可以添加到序言中:itemize
description
enumerate
\item[CTAN (Comprehensive TeX Archive Network)]
\item \textbf{CTAN (Comprehensive TeX Archive Network)}
\urlstyle{same}
\documentclass{article}
\usepackage{fullpage}
%\usepackage{graphicx} % not related to this example
%\usepackage{xcolor} % not related to this example
%\usepackage{fancyhdr} % not related to this example
%\usepackage{enumitem} % not needed for the default enumerate environment
%\usepackage[utf8]{inputenc} % default in an up to date installation
\usepackage{xurl}
\urlstyle{same}
\begin{document}
\section{Information Sites and Tools}
\begin{description}
\item["LaTeX For Beginners Handbook"] Created by the Information Services Department of the University of Edinburgh: \url{http://www.docs.is.ed.ac.uk/skills/documents/3722/3722-2014.pdf }
\item[CTAN (Comprehensive TeX Archive Network)] A free source of packages available for download that can be used inside LaTeX documents: \url{https://ctan.org/pkg/aurical}
\item[TeX Stack Exchange] A forum website for LaTeX, TeX, and other typesetting systems free for sign up and browsing. There are many veteran users here and are very helpful: \url{https://tex.stackexchange.com/}
\item[Tables Generator] A free table-generating website that allows users to generate tables for LaTeX, HTML, or other sources including the source code that can be inserted into any LaTeX document. It has some basic and limited formatting options. It was created using many pieces open-source software: \url{https://www.tablesgenerator.com/}
\item["Macros".] This document was created by Andrew Török of the University of Houston Math Department. A brief and easy to understand introduction and explanation of macros and how to create them: \url{https://www.math.uh.edu/~torok/math_6298/latex/macros.html}
\item["LaTeX Command Glossary".] A list of common LaTeX commands provided by Wikibooks:
\url{https://en.wikibooks.org/wiki/LaTeX/Command_Glossary}
\end{description}
\end{document}
如果您希望 URL 中的换行符仅出现在特定位置(例如 a.
或 a )\
,则可以使用url
包而不是xurl
。如果您想要超链接,请改用hyperref
包。(前面提到的\url
和\urlstyle{same}
命令适用于所有三个包。)
如果您想进一步自定义列表的外观,例如,第二行和后续行的缩进\item
、相邻项目之间的垂直空白或粗体和后续文本之间的空格,请查看enumitem
包及其众多选项。