0

In my latex file I want to create a table. My current code looks like the following:

\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}

However, when compiling the code I get: enter image description here

Any recommendation what I am doing wrong?

I appreciate your replies!

UPDATE

I changed the table to:

\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}

BUT I still get the error.

  • 1
    Why all the \multicolumn commands? With the exception of those in the header row, I don't think any of them do anything useful. – Torbjørn T. Jun 2 '15 at 5:45
  • @TorbjørnT. Please see my update! – Kare Jun 2 '15 at 5:52
  • @TorbjørnT. removing all multicolumn worked for me ;) – Kare Jun 2 '15 at 6:06
  • It is unclear what the problem is. Is it the white space to the right or the missing vertical lines on the header line? – Grimler Jun 2 '15 at 6:08
5
  • Your table is much too wide because of the first column and the contents sticks into the right margin without the horizontal lines following.
  • It does not make sense to me, using X for the numbers, but l for the long texts. The example below uses X for the text column.
  • \bf is deprecated since many decades. LaTeX2e has \bfseries or \textbf{...}.
  • \ul underlining command of package soul? There are already much too many lines. Also \ul expects an argument in curly braces.
  • The example uses package booktabs for three nice lines. More are not necessary.
  • Longer texts in the left column which use more than a line are formatted with indentation of the second and later lines.
  • The example makes some font setups to get a proper € sign.
  • Package siunitx is used to format the euro amounts at the decimal point.
  • Also the package provides \SI for typesetting numbers with units with proper spacing and the prevention of line breaks between number and unit.

Full example:

\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}

Result

  • Since the width of the tabularx environment is set to \linewidth, the \centering instruction between \begin{table}[htbp] and \begin{tabularx}{\linewidth}{...} is redundant. – Mico Jun 2 '15 at 6:32
  • @Mico It could be added to the definition of table, if all tables should be centered. \centering sets \parindent to zero (inside the table it is zero already, but who knows, what a class or package might set). Also it is seen by \caption. It's default is centering, but again, who knows, what package and classes might do. And if the table is made smaller at a later time, then adding \centering is likely to be forgotten. – Heiko Oberdiek Jun 2 '15 at 6:39
  • Many thanks for these explanations for why the \centering instruction needn't be redundant. :-) A separate matter: By default, siunitx interprets the , (comma) symbol in \SI{1,000}{\meter} and \SI{2,000}{\meter} as a decimal marker and replaces it with . in the output; as a result, the lengths look like they're 1 and 2 meters instead of 1,000 and 2,000 meters, respectively. I suppose this issue could be circumvented by issuing the instruction \sisetup{ input-ignore = {,}, group-minimum-digits = 4, group-separator = {,} } in the preamble. – Mico Jun 2 '15 at 7:00
  • @Mico Thanks, I had overlooked it. Also I had to remove the comma from option input-decimal-markers. – Heiko Oberdiek Jun 2 '15 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.