行之间的中心文本

行之间的中心文本

请问如何使文本在两行之间居中?

\documentclass{scrbook} 
\usepackage{mathpazo} %-- use Palatino font
\usepackage{booktabs} 
\usepackage{tablefootnote,threeparttable}
\usepackage{makecell}
\usepackage[table]{xcolor}

\begin{document}

\begin{table}[!htbp] %[h] %
    \centering
    \begin{threeparttable}
        \caption[TrigNet Station coordinates]{ITRF20 (epoch 2015.00) TrigNet station coordinates\tnote{1}}%
        \begin{tabular}{@{}ccccc@{}} 
            \toprule
            \makecell{\textbf{Local station /} \\\textbf{IGS station name} \\\textbf{and Domes}}
            & \textbf{Lo}
            & \makecell{\textbf{x /} \\\textbf{lat}}
            & \makecell{\textbf{y /} \\\textbf{long}} 
            & \makecell{\textbf{z /} \\\textbf{h}}\\ 
            \arrayrulecolor{black!50}\midrule
            
            \makecell{\textbf{Ctwn-SB /}\\\textbf{JCTW00ZAF} \\\textbf{30305M001}} 
          & \makecell{\\\\19} 
          & \makecell{5023564.4696 \\-33.95143357 \\3758401.60} 
          & \makecell{1677795.7313 \\18.46855188 \\49125.91} 
          & \makecell{-3542025.8896\\83.610}\\
            \arrayrulecolor{black!20}\midrule

           \makecell{\textbf{A few /}\\\textbf{rows} \\\textbf{below this}} & & & & \\
            
            \arrayrulecolor{black}\bottomrule
        \end{tabular}
    \begin{tablenotes}\footnotesize
    \item [1] coordinates are available as ECEF x, y, z; lat/long and SACRS with ellipsoidal height
    \end{tablenotes}
    \label{tab:trigcoord}
    \end{threeparttable}
\end{table}

\end{document}

在此处输入图片描述

我希望 -3542025.8896 与 Ctwn-SB 对齐,83.610 位于 JCTW00ZAF 和 30305M001 之间(确切位置)。请问我如何将文本居中在两行之间?

答案1

呵呵,我几乎迷失在你的表格代码中......我会用非常不同的方式来写它:

  • 不使用makecells,
  • 使用包S中定义的列siunitx来对齐小数点处的数字,以及
  • 而是threeparttable使用talltblrtabularray

\documentclass{scrbook}
\usepackage{mathpazo} %-- use Palatino font

\usepackage{xcolor}                         % not needed in this MWE
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
%\usepackage{tablefootnote,threeparttable}  % not needed in this MWE
%\usepackage{makecell}                      % not needed in this MWE

\begin{document}
    \begin{table}[!htbp] %[h] % newer use only h!
    \small
\begin{talltblr}[
caption = {ITRF20 (epoch 2015.00) TrigNet station coordinates\TblrNote{1}},
  entry = {TrigNet Station coordinates},    % for list of tables
  label = {tab:trigcoord},
note{1} = {coordinates are available as ECEF x, y, z; lat/long and SACRS with ellipsoidal height},
                ]{colspec = {@{} X[l,font=\bfseries]
                                 Q[c,si={table-format=2.0}] 
                            *{2}{Q[c,si={table-format=7.8}]} 
                                 Q[c,si={table-format=7.4}]
                            @{}},
                  row{1}  = {guard, font=\bfseries, m}
                  }
    \toprule
Local station/IGS station name and Domes
    &   Lo 
        &   x / lat 
            &   y / long
                &   z / h                           \\
    \midrule
Ctwn-SB/    
    &   &   5023564.4696
            &   1677795.7313
                & \SetCell[r=2]{}   -3542025.8896   \\
JCTW00ZAF
    &   &   -33.95143357
            &   18.46855188
                &                                   \\
30305M001
    &   19
        &   3758401.60
            &   49125.91
                &   83.610                          \\                          
    \midrule[fg=black!20]
A few rows below this
    &   &   &   &                                   \\
    \bottomrule
\end{talltblr}
    \end{table}
\end{document}

除了该代码之外,这个 MWE(在我看来)更简单,更简短和一致,可以生成更漂亮的表格:

在此处输入图片描述

相关内容