latex 中两个段落之间的表格位置问题

latex 中两个段落之间的表格位置问题

我是 Latex 新手。如果您看到以下代码片段,则说明我在两个段落之间创建了一个表格。但是,当我使用 XeLatex 编译它时,表格会向上移动,而两个段落会向下移动。我预计表格应该位于两个段落之间(红色箭头)。如何做到这一点。谢谢。

 Soundex is a phonetic algorithm designed in 1900’s. Soundex algorithm phonetically encodesgroup similar sounding consonant characters. The process usually excludes vowels except the vowels at the beginning of the word. You can find Kaykobad’s Bangla soundex encoding table in [3,19] and Mumit’s Bangla soundex table in [4]. According to the Mumit’s soundex encoding algorithm returns the following output.

\begin{table}
\centering
  \caption{Sample result of N. UzZaman and Mumit’s Bangla soundex table}
  \begin{minipage}{\textwidth}
    \begin{tabular}{lccl}
    \hline\hline 
    Corpus Name & Corpus size & Creation time & Technique of data collection\\
    \hline 
BDNC01 [6] & 12 Million Words & 6 Years & Manual- Copy and Paste\\
SUMono [7] & 27 Million Words & 4 Years & Manual- Copy and Paste\\
NHMono01 (Our Corpus) & Over 100 Million Words & 2 Months & Automatic – Crawling and scraping with powerful Python’s Scrapy framework.\\
    \hline\hline
    \end{tabular}
    \vspace{-2\baselineskip}
  \end{minipage}
  \label{table2}
\end{table}
Soundex is an ancient version of phonetic algorithm and has lots of imperfections. Therefore, we have not used soundex in our spell checker. 

在此处输入图片描述

答案1

除了表格位置的问题之外,表格大小也存在问题。它会(即使我们没有关于您的文档的任何信息)溢出到正确的文本大小上。因此,看看以下表格和定位的重新制作是否可以帮助您:

\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs, makecell, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
 Soundex is a phonetic algorithm designed in 1900’s. Soundex algorithm phonetically encodesgroup similar sounding consonant characters. The process usually excludes vowels except the vowels at the beginning of the word. You can find Kaykobad’s Bangla soundex encoding table in [3,19] and Mumit’s Bangla soundex table in [4]. According to the Mumit’s soundex encoding algorithm returns the following output.

\begin{table}[htbp] % <--- "here", "top", "bottom", "page"
    \setcellgapes{2pt}
    \makegapedcells
\caption{Sample result of N. UzZaman and Mumit’s Bangla soundex table}
    \begin{tabularx}{\linewidth}{@{} lccL @{}}
    \toprule
\makecell[lb]{Corpus\\ Name}
            & \makecell[b]{Corpus size\\ (in Words)}
                                & \makecell[b]{Creation\\ time}
                                            & Technique of data collection\\
    \midrule
BDNC01 [6]  & 12 Million        & 6 Years   & Manual- Copy and Paste\\
SUMono [7]  & 27 Million        & 4 Years   & Manual- Copy and Paste\\
\makecell[lt]{NHMono01\\ (Our Corpus)}
            & Over100 Million    & 2 Months  & Automatic – Crawling and scraping with powerful Python’s Scrapy framework.\\
    \bottomrule
    \end{tabularx}
  \label{table2}
\end{table}
Soundex is an ancient version of phonetic algorithm and has lots of imperfections. Therefore, we have not used soundex in our spell checker.
\end{document}

在此处输入图片描述

编辑: 关于在页面上定位图形:选项的含义在代码中注明。前三个:(h图像应该在这里),t(在页面顶部)和b(在页面底部)如果图像占据页面大小的 70% 以上,则可以正常工作。如果图像更大,则p对于图像,在将其插入文本后立即使用整个页面。在p这种情况下,图像将被推到文档末尾(正如 David Carlisle 指出的那样,现在已删除了答案下面的评论)。

如果您希望将图像严格地放在这两个段落之间,而不管页面上是否有足够的空间,您可以使用H包提供的位置说明符float。在这种情况下,它会将图像推到下一页的顶部,并在上一页留下空白。之后的图像将跟随下一个段落。因此使用H时应谨慎,一般不建议使用。

相关内容