# Centering text in a diagonally split table cell

I need help centering a hyphen located in a table cell that has a diagonal slash to split the table cell in two. As can be seen in my photo, the hyphen is positioned at the edge of the cell, I would like for it to be centered. I tried searching the forum and could not find an answer. Thanks in advance.

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


Also, is there a way to remove the two corner lines of the empty table cell (North West)?

• I would pick a width (possible the longest string used) and use \makebox[\mywidth]{...} to center things.. Jul 15, 2015 at 15:40
• Also, see tcolorbox to create boxes without diagonals. Jul 15, 2015 at 15:44
• What is this table trying to show? I would not understand it. As it stands now, it reads L\textsubscript{M} + P\textsubscript{C} is $7.29\times 10^{4}$ and \SI{5}{\milli M} Buffer is $6.52\times 10^{5}$ which would be no connection at all. You should try to make this clear and hopefully get rid of all those diags. Jul 15, 2015 at 15:58
• Regarding your last question: It should be \begin{tabular}{|*{5}{c|}}\cline{2-5}\multicolumn{1}{c|}{}& \SI{5}{\milli M} Buffer & ... and please load the caption package if you wish to have the captions on top. Jul 15, 2015 at 16:03
• hi thanks for your response, I need the diags because each contain two variables that have been calculated, I simply need the hyphen to be positioned in the middle and not on the edge of the table. Im not sure how to use \makebox with that, are there examples? Jul 15, 2015 at 16:09

You could put the hyphen in a parbox and play around with its sizes and alignments.

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


This table does not fit on one page, so I won't upload an image.