表格边框不贴合

表格边框不贴合

我想在我的 latex 文件中创建一个表。我当前的代码如下所示:

\begin{table}[htbp]
\centering
\begin{tabularx}{\linewidth}{|l|X|}
\hline
\multicolumn{1}{c}{{\bf \ul Type of query}}                                                                  & \multicolumn{1}{c}{{\bf \ul Fees in EUR}} \\ \hline
\multicolumn{1}{|l|}{Current Deed (full query a register number)}                                            & \multicolumn{1}{l|}{3.36}                 \\ \hline
\multicolumn{1}{|l|}{Current portion of extract (query of the A-, B- or C-sheet insert a number)}            & \multicolumn{1}{l|}{1.79}                 \\ \hline
\multicolumn{1}{|l|}{Query the last diary number (seal)}                                                     & \multicolumn{1}{l|}{1.68}                 \\ \hline
\multicolumn{1}{|l|}{Query the collection of documents (each document polled)}                               & \multicolumn{1}{l|}{1.05}                 \\ \hline
\multicolumn{1}{|l|}{Interrogation of persons directory (per person polled)}                                 & \multicolumn{1}{l|}{1.68}                 \\ \hline
\multicolumn{1}{|l|}{Query the historical register number (list of deleted entries) for the last five years} & \multicolumn{1}{l|}{1.68}                 \\ \hline
\multicolumn{1}{|l|}{Query the historical register number (list of deleted entries) without any time limit}  & \multicolumn{1}{l|}{3.99}                 \\ \hline
\multicolumn{1}{|l|}{Deed on a specific date (depending polled insert number)}                               & \multicolumn{1}{l|}{3.99}                 \\ \hline
\multicolumn{1}{|l|}{Land Registry-part excerpt on a specific date (depending interrogated sheet)}           & \multicolumn{1}{l|}{2.31}                 \\ \hline
\multicolumn{1}{|l|}{Query the last diary number (seal) on a specific date}                                  & \multicolumn{1}{l|}{2}                    \\ \hline
\multicolumn{1}{|l|}{Query the information about a journal number (additional information)}                  & \multicolumn{1}{l|}{1.68}                 \\ \hline
\multicolumn{1}{|l|}{Search for purchase contracts per cadastral}                                            & \multicolumn{1}{l|}{1.68}                 \\ \hline
\multicolumn{1}{|l|}{Information on a property group in the group directory}                                 & \multicolumn{1}{l|}{1.68}                 \\ \hline
\multicolumn{1}{|l|}{Query from the digital cadastral (DKM graphics) (up to 500 m)}                          & \multicolumn{1}{l|}{3.36}                 \\ \hline
\multicolumn{1}{|l|}{Query from the digital cadastral (DKM graphics) (up to 1,000 m)}                        & \multicolumn{1}{l|}{11.60}                \\ \hline
\multicolumn{1}{|l|}{Query from the digital cadastral (DKM graphics) (up to 2,000 m)}                        & \multicolumn{1}{l|}{44}                   \\ \hline
\multicolumn{1}{|l|}{Excerpt from the land register without land address (for up to ten plots)}              & \multicolumn{1}{l|}{3.36}                 \\ \hline
\multicolumn{1}{|l|}{Excerpt from the land register without land address (for 11-100 Land)}                  & \multicolumn{1}{l|}{11.60}                \\ \hline
\multicolumn{1}{|l|}{Excerpt from the land register with Land address (for up to ten plots)}                 & \multicolumn{1}{l|}{3.57}                 \\ \hline
\multicolumn{1}{|l|}{Excerpt from the land register with Land address (for 11 up to 100 plots)}              & \multicolumn{1}{l|}{13.70}                \\ \hline
\multicolumn{1}{|l|}{Search plot addresses in Address Directory - address search (for up to 10 hits)}        & \multicolumn{1}{l|}{1.05}                 \\ \hline
\multicolumn{1}{|l|}{Search plot addresses in Address Directory - address search (up to 100 hits)}           & \multicolumn{1}{l|}{3.36}                 \\ \hline
\multicolumn{1}{|l|}{Search plot addresses in Address Directory - address search (for up to 1,000 hits)}     & \multicolumn{1}{l|}{34}                   \\ \hline
Querying public corporations                                                                                 & 1.58                                      \\ \hline
\end{tabularx}
\caption[Caption for LOF]{Fee overview to access land registry.\protect\footnotemark}
\label{table:feesOfLandRegistry}   
\end{table}

但是,编译代码时我得到: 在此处输入图片描述

有什么建议我做错了吗?

感谢您的回复!

更新

我把表格改成:

\begin{table}[htbp]
\centering
\begin{tabularx}{\linewidth}{|l|X|}
\hline
\multicolumn{1}{c}{{\bf \ul Type of query}}                                                                  & \multicolumn{1}{c}{{\bf \ul Fees in EUR}} \\ \hline
Current Deed (full query a register number)                                             & 3.36                 \\ \hline
Current portion of extract (query of the A-, B- or C-sheet insert a number)            & 1.79                \\ \hline
Query the last diary number (seal)                                                    & 1.68                 \\ \hline
Query the collection of documents (each document polled)                               & 1.05                 \\ \hline
Interrogation of persons directory (per person polled)                                 & 1.68                 \\ \hline
Query the historical register number (list of deleted entries) for the last five years & 1.68                 \\ \hline
Query the historical register number (list of deleted entries) without any time limit  & 3.99                 \\ \hline
Deed on a specific date (depending polled insert number)                               & 3.99                 \\ \hline
Land Registry-part excerpt on a specific date (depending interrogated sheet)           & 2.31                 \\ \hline
Query the last diary number (seal) on a specific date                                  & 2                    \\ \hline
Query the information about a journal number (additional information)                  & 1.68                 \\ \hline
Search for purchase contracts per cadastral                                            & 1.68                 \\ \hline
Information on a property group in the group directory                                 & 1.68                 \\ \hline
Query from the digital cadastral (DKM graphics) (up to 500 m)                          & 3.36                 \\ \hline
Query from the digital cadastral (DKM graphics) (up to 1,000 m)                        & 11.60                \\ \hline
Query from the digital cadastral (DKM graphics) (up to 2,000 m)                        & 44                   \\ \hline
Excerpt from the land register without land address (for up to ten plots)              & 3.36                 \\ \hline
Excerpt from the land register without land address (for 11-100 Land)                  & 11.60                \\ \hline
Excerpt from the land register with Land address (for up to ten plots)                 & 3.57                 \\ \hline
Excerpt from the land register with Land address (for 11 up to 100 plots)              & 13.70                \\ \hline
Search plot addresses in Address Directory - address search (for up to 10 hits)        & 1.05                 \\ \hline
Search plot addresses in Address Directory - address search (up to 100 hits)           & 3.36                 \\ \hline
Search plot addresses in Address Directory - address search (for up to 1,000 hits)     & 34                   \\ \hline
Querying public corporations                                                                                 & 1.58                                      \\ \hline
\end{tabularx}
\caption[Caption for LOF]{Fee overview to access land registry.\protect\footnotemark}
\label{table:feesOfLandRegistry}
\end{table}

但我仍然收到错误。

答案1

  • 您的表格由于第一列而太宽,并且内容延伸到右边距而没有跟随的水平线。
  • X对我来说,使用数字没有意义,但对于长文本来说却有意义l。下面的示例用于X文本列。
  • \bf几十年来一直被弃用。LaTeX2e 有\bfseries\textbf{...}
  • \ul软件包的下划线命令soul?行数已经太多了。还\ul要求在花括号中加上参数。
  • 示例使用包booktabs完成了三行漂亮的代码。无需更多。
  • 左列中较长的文本(超过一行)将使用第二行及后续行的缩进进行格式化。
  • 该示例进行了一些字体设置以获得正确的€符号。
  • 该包siunitx用于将欧元金额格式化为小数点后的数字。
  • 该软件包还提供\SI以适当间距排版数字和单位的功能,并防止数字和单位之间出现换行。

完整示例:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{lmodern}

\sisetup{
  input-decimal-markers={.},
  input-ignore={,},
  group-minimum-digits=4,
  group-separator={,},
}

\begin{document}
\begin{table}[htbp]
\centering
\begin{tabularx}{\linewidth}{
  >{\hangindent=1em \hangafter=1 }X
  S[table-format=2.2]
}
\toprule
\multicolumn{1}{c}{\textbf{Type of query}}
& \multicolumn{1}{c}{\textbf{Fees in \texteuro}} \\
\midrule
Current Deed (full query a register number)
& 3.36                 \\
Current portion of extract (query of the A-, B- or C-sheet insert a number)
& 1.79                \\
Query the last diary number (seal)
& 1.68                 \\
Query the collection of documents (each document polled)
& 1.05                 \\
Interrogation of persons directory (per person polled)
& 1.68                 \\
Query the historical register number (list of deleted entries) for the last
five years & 1.68                 \\
Query the historical register number (list of deleted entries) without any
time limit  & 3.99                 \\
Deed on a specific date (depending polled insert number)
& 3.99                 \\
Land Registry-part excerpt on a specific date (depending interrogated sheet)
& 2.31                 \\
Query the last diary number (seal) on a specific date
& 2                    \\
Query the information about a journal number (additional information)
& 1.68                 \\
Search for purchase contracts per cadastral
& 1.68                 \\
Information on a property group in the group directory
& 1.68                 \\
Query from the digital cadastral (DKM graphics) (up to \SI{500}{\meter})
& 3.36                 \\
Query from the digital cadastral (DKM graphics) (up to \SI{1,000}{\meter})
& 11.60                \\
Query from the digital cadastral (DKM graphics) (up to \SI{2,000}{\meter})
& 44                   \\
Excerpt from the land register without land address (for up to ten plots)
& 3.36                 \\
Excerpt from the land register without land address (for 11--100 Land)
& 11.60                \\
Excerpt from the land register with Land address (for up to ten plots)
& 3.57                 \\
Excerpt from the land register with Land address (for 11 up to 100 plots)
& 13.70                \\
Search plot addresses in Address Directory - address search (for up to 10
hits)        & 1.05                 \\
Search plot addresses in Address Directory - address search (up to 100 hits)
& 3.36                 \\
Search plot addresses in Address Directory - address search (for up to 1,000
hits)     & 34                   \\
Querying public corporations
& 1.58                                      \\
\bottomrule
\end{tabularx}
\caption[Caption for LOF]{Fee overview to access land
registry.\protect\footnotemark}
\label{table:feesOfLandRegistry}
\end{table}
\end{document}

结果

相关内容