我需要帮助将位于表格单元格中的连字符居中,该单元格有一条斜线将表格单元格一分为二。如我的照片所示,连字符位于单元格的边缘,我希望它居中。我尝试搜索论坛,但找不到答案。提前致谢。
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{array}
\usepackage{fixltx2e}
\usepackage{tikz}
\usepackage{diagbox}
\begin{document}
\begin{table}[h!]
\centering
{
\renewcommand\arraystretch{2}
\caption{Microscopic binding constants, $K_1$ (bottom) and $K_2$ (top) for various hosts and guests interaction}
\begin{tabular}{|c*{4}{|c}|}
\multicolumn{3}{c}{} \\
\hline
& 5 \si{\milli}M Buffer & 100 \si{\milli}M Buffer & 20\% EtOH & 80\% EtOH \\
\hline
L\textsubscript{M} + P\textsubscript{C} & \diagbox[]{$7.29\times 10^{4}$}{$6.52\times 10^{5}$}& \diagbox[]{$1.16\times 10^{5}$}{$3.95\times 10^{5}$} &\diagbox[]{$4.85\times 10^{4}$}{$1.88\times 10^{6}$}&\diagbox[]{$4.95\times 10^{5}$}{$1.13\times 10^{5}$}\\
\hline
L\textsubscript{PY} + P\textsubscript{C} & ? &\diagbox[]{$1.86\times 10^{5}$}{$4.92\times 10^{4}$} & \diagbox[]{$1.28\times 10^{5}$}{$1.31\times 10^{5}$} &\diagbox[]{$2.95\times 10^{5}$}{$1.09\times 10^{4}$}\\
\hline
L\textsubscript{P} + P\textsubscript{C} & \diagbox[]{$5.05\times 10^{3}$}{-}& \diagbox[]{$2.78\times 10^{3}$}{$5.49\times 10^{2}$} &?&\diagbox[]{$7.05\times 10^{3}$}{$5.09\times 10^{4}$}\\
\hline
L\textsubscript{I} + P\textsubscript{C} &?&?& \diagbox[]{$4.74\times 10^{4}$}{$1.25\times 10^{5}$}& \diagbox[]{$1.05\times 10^{6}$}{$9.90\times 10^{4}$}\\
\hline
\end{tabular}
}
\end{table}
\end{document}
另外,有没有办法删除空表格单元格(西北)的两条角线?
答案1
您可以将连字符放在 parbox 中并调整其大小和对齐方式。
% arara: pdflatex
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{diagbox}
\usepackage{caption}
\usepackage{siunitx}
\usepackage{mathtools}
\newcommand*{\ethanol}{EtOH}
\newcommand*{\MBC}[2]{\text{#1}_{\mathrm{#2}}}
\begin{document}
\begin{table}[h!]
\centering
\renewcommand\arraystretch{1.2}
\caption[Microscopic binding constants]{Microscopic binding constants, $K_1$ (bottom) and $K_2$ (top) for various hosts and guests interaction}
\begin{tabular}{|*{5}{c|}}\cline{2-5}
\multicolumn{1}{c|}{}& \SI{5}{\milli M} Buffer & \SI{100}{\milli M} Buffer & \SI{20}{\percent} \ethanol & \SI{20}{\percent} \ethanol \\
\hline
$\MBC{L}{M} + \MBC{P}{C}$ & \diagbox[]{$7.29\times 10^{4}$}{$6.52\times 10^{5}$}& \diagbox[]{$1.16\times 10^{5}$}{$3.95\times 10^{5}$} &\diagbox[]{$4.85\times 10^{4}$}{$1.88\times 10^{6}$}&\diagbox[]{$4.95\times 10^{5}$}{$1.13\times 10^{5}$}\\
\hline
$\MBC{L}{PY} + \MBC{P}{C}$ & ? &\diagbox[]{$1.86\times 10^{5}$}{$4.92\times 10^{4}$} & \diagbox[]{$1.28\times 10^{5}$}{$1.31\times 10^{5}$} &\diagbox[]{$2.95\times 10^{5}$}{$1.09\times 10^{4}$}\\
\hline
$\MBC{L}{P} + \MBC{P}{C}$ & \diagbox[]{$5.05\times 10^{3}$}{\parbox[c][.4cm][b]{.6cm}{--}}& \diagbox[]{$2.78\times 10^{3}$}{$5.49\times 10^{2}$} &?&\diagbox[]{$7.05\times 10^{3}$}{$5.09\times 10^{4}$}\\
\hline
$\MBC{L}{I} + \MBC{P}{C}$ &?&?& \diagbox[]{$4.74\times 10^{4}$}{$1.25\times 10^{5}$}& \diagbox[]{$1.05\times 10^{6}$}{$9.90\times 10^{4}$}\\
\hline
\end{tabular}
\end{table}
\end{document}
该表格无法放在一页上,因此我不会上传图片。