1

I am relatively new to Latex. I am trying to create a table which holds a number of equations. I have been successful with shorter equations but I am getting stuck with longer ones as they go over the right margin of the page. I have attempted a number of solutions that I have found around the web including, split, array, and align none of which have been successful. I believe the issue I am having is that the equation is all within the \abs{} function from the physics package, though I am not certain about this.

Here is part of the table I am attempting to create, with the final equation being the one I am struggling with.

\begin{table}[phtb]
\caption{Test}
\label{tab:2.2}
\begin{center}
    \begin{tabularx}{\textwidth}{L{3.4cm}C{3.0cm}C{6.6cm}}
        \toprule
        Metric & Type of measurement& Calculation\\[6pt]
        \midrule
        Absolute error per cell & Composition & $\abs{\frac{\sum_{i=1}^{N}\abs{E_{i}-O_{i}}}{N}}$\\[6pt]
        Maximum absolute error & Composition & $\bigvee_{i=1}^{N}\abs{E_{i}-O_{i}}$\\[6pt]
        Mean absolute error & Composition & $\frac{1}{N}\sum_{i=1}^{N}\abs{E_{i}-O_{i}}$\\[6pt]
        Median absolute error* & Composition & $\frac{\abs{mE_{N/2}-mO_{N/2}} + \abs{mE_{N/2+1}-mO_{N/2+1}}}{2}$\\[6pt]
        Minimum absolute error & Composition & $\bigwedge_{i=1}^{N}\abs{E_{i}-O_{i}}$\\[6pt]
        $\Delta$ Moran’s I* & Configuration & $\abs{(\frac{N}{\sum_{x}\sum_{y}\omega_{xy}}\frac{\sum_{x}\sum_{y}\omega_{xy}(E_{x}-\bar{E})(E_{y}-\bar{E})}{\sum_{x}(E_{x}-\bar{E})^{2}})-(\frac{N}{\sum_{x}\sum_{y}\omega_{xy}}\frac{\sum_{x}\sum_{y}\omega_{xy}(O_{x}-\bar{O})(O_{y}-\bar{O})}{\sum_{x}(O_{x}-\bar{O})^{2}})}$\\
        \bottomrule
    \end{tabularx}
\end{center}
\end{table}
3
  • This issue is most likely similar to Left/Right across multi-line equation. How is \abs{...} defined?
    – Werner
    Feb 6, 2017 at 6:53
  • Off-topic: Since the tabularx environment occupies the full width of the text block, placing it in a center environment is pointless. Actually, since it looks like you're not using the X column type (or a column type based on X), maybe using the center environment is pointless after all; it could be that you're simply mis-using the tabularx environment...
    – Mico
    Feb 6, 2017 at 7:48
  • 2
    How did you define L and C (here: \begin{tabularx}{\textwidth}{L{3.4cm}C{3.0cm}C{6.6cm}})? Please post a complete minimal working example (MWE)!
    – CarLaTeX
    Feb 6, 2017 at 7:48

1 Answer 1

1

For easy legibility, you should aim to typeset the equations in display style, not text style. I would also like to suggest you use a multlined environment for the long formula in the final row of the table. And, since you're not really making use of the machinery of the tabularx environment, just use a tabular environment.

enter image description here

\documentclass{article}
\usepackage{array,booktabs,mathtools,caption}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage[a4paper,margin=2.5cm]{geometry} % set page parameters suitably
\captionsetup{skip=0.333\baselineskip}
\begin{document}

\begin{table}[phtb]
\centering
\caption{Test}
\label{tab:2.2}
\begin{tabular}{@{} l C{3.0cm} >{$\displaystyle}C{7.7cm}<{$} @{}}
    \toprule
    Metric & Type of measurement& $Calculation$\\
    \midrule
    Absolute error per cell & Composition & \abs[\bigg]{\frac{\sum_{i=1}^{N}\abs{E_{i}-O_{i}}}{N}} \\ \addlinespace
    Maximum absolute error  & Composition & \bigvee_{i=1}^{N}\abs{E_{i}-O_{i}}\\ \addlinespace
    Mean absolute error     & Composition & \frac{1}{N}\sum_{i=1}^{N}\abs{E_{i}-O_{i}}\\ \addlinespace
    Median absolute error*  & Composition & \frac{\abs{mE_{N/2}-mO_{N/2}} + \abs{mE_{N/2+1}-mO_{N/2+1}}}{2}\\ \addlinespace
    Minimum absolute error  & Composition & \bigwedge_{i=1}^{N}\abs{E_{i}-O_{i}}\\ \addlinespace
    $\Delta$Moran's I*      & Configuration & 
    \begin{multlined}
    \abs[\bigg]{\frac{N}{\sum_{x}\sum_{y}\omega_{xy}}
    \frac{\sum_{x}\sum_{y}\omega_{xy}(E_{x}-\bar{E})(E_{y}-\bar{E})}{\sum_{x}(E_{x}-\bar{E})^{2}}\\
    -\frac{N}{\sum_{x}\sum_{y}\omega_{xy}}
    \frac{\sum_{x}\sum_{y}\omega_{xy}(O_{x}-\bar{O})(O_{y}-\bar{O})}{\sum_{x}(O_{x}-\bar{O})^{2}}}
    \end{multlined}\\
    \bottomrule
\end{tabular}
\end{table}
\end{document}

You must log in to answer this question.