我在乳胶代码中自动生成表格列表时遇到问题。实际上我是乳胶新手我尝试添加\ listoftables还有一些软件包如fancyhdr仍然无法实现。我在给一个示例代码请告诉我这些变化。
\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{fancyhdr}
\begin{document}
\listoftables
\noindent Test Cases
\noindent Test Case 1
\begin{enumerate}
\item ID1: Taking input query from user and store raw data
\item DESCRIPTION: Allow user to provide input from available list of keywords and
store collected raw data in database.
\end{enumerate}
\begin{tabular}{|p{0.8in}|p{0.9in}|p{0.9in}|p{0.9in}|p{0.9in}|} \hline
Steps & Input & Expected output & Actual Result & Remarks \\ \hline
Select the keyword as required & Keyword is given as input for further processing &
Background process for collecting tweets related to keyword must start & Background
process for collecting tweets related to keyword is started & Pass \\ \hline
Store raw tweet data in temporary storage & Raw tweet data collected by background
process & The raw tweet data must be stored in database & The raw tweet data is stored
in database & Pass \\ \hline
\end{tabular}
\textbf{Table 1: Test Case 1}
\noindent \textbf{}
\noindent Test Case 2
\begin{enumerate}
\item ID2: Processing and displaying collected data
\item DESCRIPTION: The raw tweets need to be separated, categorized and processed
tweets are displayed.
\end{enumerate}
\begin{tabular}{|p{0.8in}|p{0.9in}|p{0.9in}|p{0.9in}|p{0.9in}|} \hline
Steps & Input & Expected output & Actual result & Remarks \\ \hline
Run background process for sorting tweets & Raw tweets are provided for sorting &
Tweets must be processed for separating their properties and stored in other tables as
per attributes & Tweets are processed as per their properties and stored in other
tables as per attributes & Pass \\ \hline
Retrieve tweets from database and show them on user interface & Query for retrieving
tweets from database & The tweets must be displayed on user interface with name and
profile picture of tweeter user who tweeted. & The tweets are displayed on the user
interface with all expected properties & Pass \\ \hline
\end{tabular}
\textbf{Table 2: Test Case 2}
\end{document}
答案 0 :(得分:0)
只有tabular
只是LaTeX中的一个盒子,可以在任何地方使用;它并不代表被认为是table
的东西,这是你为了在表格列表(LoT)中放置东西而“需要”的第一件事。好吧,从技术上讲,你不需要一个table
,但我马上就会明白这一点。在您的示例中,您可以使用
\listoftables
...
\begin{table}[ht]
\begin{tabular}{..}
...
\end{tabular}
\caption[This is a table]{This is a table that holds valuable information.}
\end{table}
...
这是进入LoT的\caption
内容的一部分。更具体地说,它是(可选的)第一个参数,或者如果没有指定,则是在LoT中打印的(强制性)第二个参数。
请注意,我们已将tabular
包裹在table
内。后者称为浮点数,它可以在文档中更多。如果你想管理这个浮动的位置(也许是因为你不喜欢LaTeX决定这个的方式),请阅读How to influence the position of float environments like figure
and table
in LaTeX?
强制展示位置的一种方法是完全避免使用table
(浮动),并使用caption
package的\captionof{table}
功能。这使得LaTeX认为它在table
(浮动)中,并允许您设置“常规\caption
”。微小的capt-of
package提供类似的功能 * 。要清楚,你可以使用
...
\begin{tabular}{..}
...
\end{tabular}\par\nobreak
\captionof{table}[This is a table]{This is a table that holds valuable information.}
...
使用\par\nobreak
尝试将tabular
及其关联\caption
放在同一页面上。
当然,上述讨论同样适用于figure
。也就是说,您可以在文档中的任何位置(例如)\includegraphics[..]{...}
,但您需要为\caption
(或figure
)使用适当的\captionof
来制作它进入了数字清单(LoF)。
* caption
和capt-of
都会受到以下事实的影响:它会永久性地欺骗 :它会更新\@captype
但永远不要重置它。因此,最好提供一些使用\captionof
的范围,例如\begingroup
... \endgroup
。