表格列数

表格列数

当我想删除两列时我哪里犯了错误?

我有这个代码:

\documentclass[12pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}

\usepackage[margin=2.5cm]{geometry}  % choose suitable text block parameters
\usepackage{lmodern,textcomp}

\usepackage{amsmath,amssymb,bm} 
\usepackage[nottoc]{tocbibind}
\usepackage{booktabs,siunitx} 

\newcommand{\Mo}{\mathrm{M}_{\odot}}
\newcommand{\Ro}{\mathrm{R}_{\odot}}

\begin{document}

\begin{table}
\footnotesize

\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}}
  l
  S[table-format=1.6(2)]
  S[table-format=5.3(2)]
  S[table-format=2.3]
  *{5}{S[table-format=3.2]}
  @{}
}
\toprule
Zdroj & 
{$P$} & 
{$T_0$}  & 
{$e$} &
{$\omega$} & 
{$i$} & 
{$a$} & 
{$a$} &
{$M_1$} \\[0.33ex]
  & {(dny)}
  & {(RJD)}
  & {} 
  & {(${}^\circ$)} 
  & {(${}^\circ$)} 
  & {($\Ro$)}
  & {($\Mo$)}
  & {($\Mo$)}   
  \\
\midrule

1 & 5,732436(15) & 54002,780(46) & 12.345 & 123.45 & 123.45 & 123.45 & 123.45 &\\

\bottomrule
\addlinespace
\multicolumn{9}{@{}l}{\textit{Pozn:} $^a$ Směrodatná chyba odhadu metodou Monte Carlo.}
\end{tabular*}

\caption{Maximálně věrohodné odhady v~modelu M.}\label{tab03:Nejaka}
\end{table}

\end{document}

我以错误的方式编辑:

\documentclass[12pt,a4paper]{report}
\usepackage[english,czech]{babel}
\usepackage[margin=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern,textcomp}
\usepackage{amsmath,amssymb,bm} 
\usepackage[nottoc]{tocbibind}
\usepackage{icomma,dcolumn,booktabs} 

\newcommand{\mc}[1]{\multicolumn{1}{c}{#1}}
\usepackage{tabularx,ragged2e} 
\newcolumntype{d}[1]{D{.}{,}{#1}}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\begin{document}

\begin{table}\small
\setlength\tabcolsep{3pt} 
\begin{tabularx}{\textwidth}{@{} L cc c c *{2}{c} @{}}
\toprule
Zdroj & $P$ & $T_0$ & \mc{$e$} & \mc{$\omega$} & \mc{$i$} & \mc{$a$} & \mc{$a$} & \multicolumn{1}{c@{}}{$M_1$} \\[0.33ex]
& (dny) & (RJD) & & \mc{($^\circ$)}  &  \mc{($\mathrm{M}_{\odot}$)} & \multicolumn{1}{c@{}}{($\mathrm{M}_{\odot}$)} \\
\midrule
1 & 5,732436(15) & 54002,780(46) & 0,0910(37) & 12.345 & 123.45 & 123.45 \\

\bottomrule
\addlinespace
\multicolumn{6}{@{}l}{\footnotesize\textit{Pozn:} $^a$ Směrodatná chyba odhadu metodou Monte Carlo.}
\end{tabularx}

\caption{Maximálně věrohodné odhady v~modelu M.}\label{tab03:Nejaka}
\end{table}

\end{document}

谢谢

答案1

\multicolumn{1}{c}{...}您的表格有 8 个居中列,而不是 6 个。我借此机会简化了您的代码 - 在列中使用有什么意义c

\documentclass[12pt,a4paper]{report}
\usepackage[english,czech]{babel}
\usepackage[margin=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern,textcomp}
\usepackage{amsmath, amssymb, bm}
\usepackage[nottoc]{tocbibind}
\usepackage{icomma,dcolumn,booktabs}

\newcommand{\mc}[1]{\multicolumn{1}{c}{#1}}
\usepackage{tabularx, ragged2e}
\newcolumntype{d}[1]{D{.}{,}{#1}}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}

\begin{document}

\begin{table}\small
\setlength\tabcolsep{3pt}
\begin{tabularx}{\textwidth}{@{} L *{8}{c} @{}}
\toprule
Zdroj & $P$ & $T_0$ & $e$ & $\omega$ & $i$ & $a$ & $a$ & $M_1$ \\[0.33ex]
& (dny) & (RJD) & & ($^\circ$) & ($\mathrm{M}_{\odot}$) & ($\mathrm{M}_{\odot}$) \\
\midrule
1 & 5,732436(15) & 54002,780(46) & 0,0910(37) & 12.345 & 123.45 & 123.45 \\
\bottomrule
\addlinespace
\multicolumn{6}{@{}l}{\footnotesize\textit{Pozn:} $^a$ Směrodatná chyba odhadu metodou Monte Carlo.}
\end{tabularx}

\caption{Maximálně věrohodné odhady v~modelu M.}\label{tab03:Nejaka}
\end{table}

\end{document} 

在此处输入图片描述

相关内容