3

I'm trying to fill a table with equations, but some of the equations are so long that the table is cut off completely on the right side. I just started working with latex yesterday so my knowledge is pretty minimal at this point. Does anyone have a suggestion for how to fix this? I'm guessing that it is not ideal to just make the font super small, nor do I really want to split the table unless it's completely necessary.

Here is what I have for the table so far:

    \begin{table}[h!]
    \centering
    \begin{tabular}{c|c|c|c|c|c|c}
    Time & $F_{in}$ & $F_{out}$ & k$_w$ & M & CO$_2$ & CO$_2$ \\
    (kyr) & (Gton kyr$^{-1}$) &  (Gton kyr$^{-1}$) &  (kyr$^{-1}$) & (Gton)&   

    (Gton) & (ppmv)\\\hline65,000 & 100&0.1 & 0.1176 & $1.3043\times   10^{8}$& 596 & 280\\ & & & & & &\\\hline
   sort(($0:25:65000$)','descend') &$
   F_{in}\times ones(\frac{t1-t2+25}{25},1)$ &$K\times elevation$ & 

   \tfrac{F_{in}}{Elevation}$ & $SA \times elevation$ & $\left ( M(t) \div 


   M(0)))\right )^{2}\times pCO_{2}(0)) \ast 10^{-6} (\frac{12}

   {.78(28)+.21(32)+.01(40)})\ast 5.14\ast 10^{21}g\ast \frac{1Gton}   

   {10^{15}g} $&\\& & & & & &\\
   \end{tabular}
   \label{tab:boxmodel}
   \end{table}

It is only the last equation that is getting cut off, since it is super long.

I'd appreciate any feedback or links to similar questions. Thanks!

5
  • Welcome to TeX.SX! Please show us a compilable version of your document that has this issue. Remove all unnecessary extra parts, only the table with equations
    – user31729
    Feb 6, 2016 at 15:55
  • Welcome to TeX SE! If I have understood your problem, your best option would be to align equations inserting line breaks, so you have still beauty with a proper display of the equation. But as Christian noted, it'd be easier for other users to take a look at your code concerning the table.
    – Alenanno
    Feb 6, 2016 at 16:08
  • Your table cell content does not wrap around, that's the cause
    – user31729
    Feb 6, 2016 at 17:12
  • I tried to improve this table, but it's awful (sorry) I think, a redesign of visualization of the data would be much more useful
    – user31729
    Feb 6, 2016 at 19:17
  • For just one entry you could use \multicolumn{1}{p{2cm}}{...} for example. Feb 6, 2016 at 19:39

1 Answer 1

2

You can have a solution swapping rows and columns and loading makecell for line breaks in cells. Here is a possible layout. In addition, I loaded siunitx to format coherently the (nonstandard) units in this table, and mhchem to have a simpler code for chemical formulae.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[showframe]{geometry}
 \usepackage{array, tabularx, makecell, boldline}
\renewcommand\cellalign{tc}
\usepackage{siunitx}
\usepackage[version=4]{mhchem}
\DeclareSIUnit\ton{ton}
\DeclareSIUnit\Gton{\giga\ton}
\DeclareSIUnit\ppmv{ppmv}
\DeclareSIUnit\yr{{yr}}
\DeclareSIUnit\kyr{{\kilo\yr}}

\begin{document}

\begin{table}[h!]
  \centering%
  \setlength\tabcolsep{4pt}
  \setcellgapes{1.5ex}\makegapedcells
  \begin{tabularx}{\linewidth}{V{2.5}c V{2.5}c|X V{2.5}}
    \Xhline{1pt}
    \makecell{Time \\(\si{\kyr})} & 65,000 & sort(($0:25:65000$)','descend') \\
    \hline
    \makecell{ $F_\text{in}$ \\ (\si{\Gton\per\kyr})}& 100 & $ F_\text{in}\times ones\Bigl(\dfrac{t1-t2+25}{25},1\Bigr)$\\
    \hline
    \makecell{$F_\text{out}$ \\ (\si{\Gton\per\kyr})}& 0.1 & $ K\times \text{elevation} $ \\
    \hline
    \makecell{ k\textsubscript{w} \\ (\si{\per\kyr})}& 0.1176 & $ \dfrac{F_\text{in}}{\text{Elevation}}$ \\
    \hline
    \makecell{M \\ (\si{\Gton})}& \num{1.3043E8} & $ SA \times \text{elevation}$ \\
    \hline
    \makecell[tc]{\ce{CO2} \\ (\si\Gton)}& 596 & $\begin{aligned}[t]
    & \bigl(M(t)\div M(0)\bigr)^{2}\times p_{\ce{CO2}}(0) \ast 10^{-6} \Bigl(\dfrac{12}{.78(28)+.21(32)+.01(40)}\Bigr)\\& \ast 5.14\ast \num{1E21}g\ast \dfrac{\SI{1}{\Gton}} {\num{1E15}g}
    \end{aligned} $ \\
    \hline
    \makecell{\ce{CO2} \\ (\si{\ppmv})}& 280 & \\
    \Xhline{1pt}
  \end{tabularx}
  \label{tab:boxmodel}
\end{table}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .