我正在使用自己找到的模板,通常不会出现任何问题,但我在表格放置方面遇到了问题。我试图在文档的最后一页打印四个表格,但第四个表格一直移动到另一页,尽管前一页有足够的空间。我该如何解决这个问题?
(一些评论 - 提前为格式道歉 - 无法弄清楚如何阻止粘贴文本,因此缩进很混乱。另外,我知道这里包含了很多我不需要的额外内容,但此时我不想从代码中删除任何内容。)
提前致谢!
\documentclass[11pt, a4paper]{article}
\usepackage[inner=2cm,outer=2cm,top=2.5cm,bottom=2.5cm]{geometry}
\pagestyle{empty}
\usepackage{graphicx}
\usepackage{fancyhdr, lastpage, bbding, pmboxdraw}
\usepackage[usenames,dvipsnames]{color}
\definecolor{darkblue}{rgb}{0,0,.6}
\definecolor{darkred}{rgb}{.7,0,0}
\definecolor{darkgreen}{rgb}{0,.6,0}
\definecolor{red}{rgb}{.98,0,0}
\usepackage[colorlinks,pagebackref,pdfusetitle,urlcolor=darkblue,citecolor=darkblue,linkcolor=darkred,bookmarksnumbered,plainpages=false]{hyperref}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\pagestyle{fancyplain}
\fancyhf{}
\lhead{ \fancyplain{}{MAT 135} }
\rhead{ \fancyplain{}{March 5, 2019} }
\thispagestyle{plain}
\usepackage{listings}
\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}
\usepackage{verbatim}
\usepackage{fancyvrb}
\usepackage{acronym}
\usepackage{hyperref}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{array}
\usepackage{multicol}
\VerbatimFootnotes
\definecolor{OliveGreen}{cmyk}{0.64,0,0.95,0.40}
\definecolor{CadetBlue}{cmyk}{0.62,0.57,0.23,0}
\definecolor{lightlightgray}{gray}{0.93}
\lstset{
basicstyle=\ttfamily,
keywordstyle=\color{OliveGreen},
commentstyle=\color{gray},
numbers=left,
numberstyle=\tiny,
stepnumber=1,
numbersep=5pt,
backgroundcolor=\color{lightlightgray},
frame=none,
tabsize=2,
captionpos=t,
breaklines=true,
breakatwhitespace=false,
showspaces=false,
showtabs=false,
columns=flexible,
morekeywords={__global__, __device__},
}
\begin{document}
\begin{center}
{\Large{Sections 4.2 and 4.3 Questions}}
\end{center}
\begin{center}
March 5, 2019
\end{center}
\vspace{5mm}
\noindent 1. Consider the functions $f(x)=x^2$ and $g(x)=\sqrt{x}$ on the interval $(0,\infty)$. Compare their slopes.
\vspace{5mm}
\noindent 2. Define concave upward and concave downward.
\vspace{5mm}
\newpage
\begin{table}[h]
\begin{center
\begin{tabular}{|c|c|c|c|}
\hline
\textbf{f''(x)} & - & 0 & +\\
\hline
\textbf{f'(x)} & decreasing & horizontal tangent & increasing\\
\hline
\textbf{f(x)} & concave down & inflection point & concave up\\
\hline
\end{tabular}
\end{center}
\end{table}
\begin{table}[h]
\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline
\textbf{f'(x)} & - & 0 & +\\
\hline
\textbf{f(x)} & decreasing & horizontal tangent & increasing\\
\hline
\end{tabular}
\end{center}
\end{table}
\begin{table}[h]
\begin{center}
\caption{Identifying Inflection Points of $f$ Based on The Sign of $f''$}
\begin{tabular}{|c|c|c|c|}
\hline
& c & & \\
\hline
- & & + & inflection point\\
\hline
- & & - & not an inflection point\\
\hline
+ & & - & inflection point\\
\hline
+ & & + & not an inflection point\\
\hline
\end{tabular}
\end{center}
\end{table}
\begin{table}[h]
\begin{center}
\caption{Classifying Local Extrema of $f$ Based on the Sign of $f'$
\begin{tabular}{|c|c|c|c|}
\hline
& c & & \\
\hline
- & & + & local minimum\\
\hline
- & & - & not local extremum\\
\hline
+ & & - & local maximum\\
\hline
+ & & + & not local extremum\\
\hline
\end{tabular}
\end{center}
\end{table}
\end{document}
答案1
您描述的问题的直接原因是您有四个table
环境,而article
默认情况下文档类仅允许在单个页面上放置最多三个这样的环境。这就是为什么第四个环境table
被推到了下一页。
解决此问题的一种方法是发出指令
\setcounter{totalnumber}{4}
\setcounter{topnumber}{4}
\setcounter{bottomnumber}{4}
在序言中。当然,如果你发现自己需要table
在一页上放置 7 个(可能非常小,对吧?)环境,你应该将上面的内容更改为
\setcounter{totalnumber}{7}
\setcounter{topnumber}{7}
\setcounter{bottomnumber}{7}
顺便说一句,我不得不说,你的 LaTeX 的整体质量远非完美。当然,代码包含两个语法错误 --\begin{center
和 \caption{Classifying Local Extrema of $f$ Based on the Sign of $f'$
; 你能发现缺少的花括号吗? --必须在文档编译之前必须修复。而写\textbf{f''(x)}
、\textbf{f''(x)}
和\textbf{f''(x)}
必定会引起不少人的注意,甚至可能让一些读者大出血。请考虑改写$\mathbf{f}''(\mathbf{x})}$
、$\mathbf{f}'(\mathbf{x})}$
和$\mathbf{f}(\mathbf{x})}$
。