我有这个小.tex 文件。
\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{titling}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}
\setlength{\droptitle}{-3.5cm}
\setlength{\parindent}{0cm}
\newcommand{\squad}{\hspace{0.5em}}
\author{vladgovor77771}
\title{Some article}
\begin{document}
\maketitle
\textbf{Task 1} \newline
Task description: \newline
\end{document}
编译时,会警告线路
\textbf{Task 1} \newline
带有以下消息:
“未满\hbox(坏度10000)”。
我该如何解决这个问题?
我有一个类似的问题,我通过删除下面没有任何文字的每个句子的任何
\newline
或 \\
来解决它。
例如,导致该问题的两个示例:
An example. \\
This is well used. \\
This line will cause the error. \\
(I'm a new paragraph) \\
Because there's nothing directly underneath.\\
The last line does NOT require a "newline".
This is a thid paragraph. \\
:D
对于数字或类似的东西也是如此
This is a line.
Putting a "newline", as here, before a \begin will cause the error. \\
\begin{figure}[h]
....
\end{figure}
一个快速而好的解决方案是使用包
parskip
,而不是使用 \newline
或 \\
进行换行,只需插入一个空行
\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{titling}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}
\usepackage{parskip} %% <-- added
\setlength{\droptitle}{-3.5cm}
\setlength{\parindent}{0cm}
\newcommand{\squad}{\hspace{0.5em}}
\author{vladgovor77771}
\title{Some article}
\begin{document}
\maketitle
\textbf{Task 1}
Task description:
\end{document}
警告将会消失。
顺便说一句,要了解为什么会发生这种情况,请参阅 TeX Stack Exchange 上的这个问题。
您可以简单地留下一个空行来开始一个新段落,而不是使用
\newline
强制使用未满的框:
\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{titling}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}
\setlength{\droptitle}{-3.5cm}
\setlength{\parindent}{0cm}
\newcommand{\squad}{\hspace{0.5em}}
\author{vladgovor77771}
\title{Some article}
\begin{document}
\maketitle
\textbf{Task 1}
Task description:
blabla
\end{document}
参见TeX论坛写的答案:
并且不要强迫未满的盒子,这是一种不好的做法...