0

When I compile the table below (I tried to edit the code so that it shows well on this site, but that too doesn't seem to work), I get very strange results:

  • I want all numbers to be in the {3}{1} format but this is not the case for the number in the third and 6th column.
  • How can I remove the large space between the first digit and the opening parenthesis in the second and third column?
  • I want a vertical line after the second and fourth column (and no vertical line after the third).

This is the code:

\usepackage{numprint}
\npdecimalsign{.}
\nprounddigits{1}
\begin{table}[ht]
\centering
\begin{tabular}{|r| n{3}{1}  n{3}{1} l| n{3}{1} n{3}{1} l| n{3}{1} n{3}{1} l|}
\hline
    & \multicolumn{2}{c|}{\textbf{e1}}&\multicolumn{2}{ c| }{\textbf{e2}} &\multicolumn{2}{c|}{\textbf{e3}}\\ 
  \hline
\textbf{e1}&&&1.712682&(0.9381452)&2.768738&(1.646461)\\
\textbf{e2}&0.5613594&(0.4711274)&&&1.959158&(1.001164)\\
\textbf{e3}&185.9336662&(2.1302318)&140.417800&(1.797353)&&\\
   \hline
\end{tabular}
\label{tab:tab1}
\caption{this data table}
\end{table}
\npnoround
3

You have additional l-columns, just replace l| by |. And using n{1}{1} instead of n{3}{1} solves the problem with the additional spaces after (:

\documentclass{article}
\usepackage{numprint}
\usepackage{array}
\begin{document}
\npdecimalsign{.}
\nprounddigits{1}
\begin{table}[ht]
\centering
\begin{tabular}{|r| n{3}{1}  n{1}{1} | n{3}{1} n{1}{1} | n{3}{1} n{1}{1} |}
\hline
    & \multicolumn{2}{c|}{\textbf{e1}}&\multicolumn{2}{ c| }{\textbf{e2}}
 &\multicolumn{2}{c|}{\textbf{e3}}\\
  \hline
\textbf{e1}&&&1.712682&(0.9381452)&2.768738&(1.646461)\\
\textbf{e2}&0.5613594&(0.4711274)&&&1.959158&(1.001164)\\
\textbf{e3}&185.9336662&(2.1302318)&140.417800&(1.797353)&&\\
   \hline
\end{tabular}
\label{tab:tab1}
\caption{this data table}
\end{table}
\npnoround
\end{document}

Result

2

Regarding your first request about the n{3}{1}

format, you have to omit the "l" specifier in the tabular definition line.

Regarding the other aspects, I came back when I have enough time.

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.