1

I've edited a table on Word in regard of its complication (mathematic formulas, merged cells...) and I've converted it to LaTeX version with GrindEQ Math Word-to-LaTeX converter. The problem is that the code does not give a suitable look on my LaTeX paper. The table is horizontal while my paper is in portrait mode, that's why the table exceeds the page limits. I want it to have the same width as the paragraphs.

\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[pdftex]{graphicx}
\begin{document}
\begin{tabular}{|p{1in}|p{0.6in}|p{1.0in}|p{0.6in}|p{1.0in}|p{0.6in}|p{0.3in}|p{1.0in}|p{0.6in}|p{1.0in}|} \hline 
& \textbf{BANK} & \multicolumn{2}{|p{1.6in}|}{\textbf{Participant 1}} & \multicolumn{2}{|p{1.6in}|}{\textbf{Participant 2}} & \textbf{\dots } & \multicolumn{2}{|p{1.6in}|}{\textbf{Participant (n-1)}} & \textbf{Participant n} \\ \hline 
& \textbf{Investing option} & \textbf{Take-up option} & \textbf{Investing option} & \textbf{Take-up option} & \textbf{Investing option} & \textbf{\dots } & \textbf{Take-up option} & \textbf{Investing option} & \textbf{Investing option} \\ \hline 
\textbf{T${}_{1}$} & $C\times (n+1)$\textit{} & \multicolumn{2}{|p{1.6in}|}{$-\ C$\textit{}} & \multicolumn{2}{|p{1.6in}|}{$-\ C$\textit{}} & \textit{\dots } & \multicolumn{2}{|p{1.6in}|}{$-\ C$\textit{}} & $-\ C$\textit{} \\ \hline 
\textbf{T${}_{2}$} & $-\ C$\textit{} & $C\times (n+1)\times (1-w_1)$\textit{} & $-\ C$\textit{} & \multicolumn{2}{|p{1.6in}|}{$-\ C$\textit{}} & \textit{\dots } & \multicolumn{2}{|p{1.6in}|}{$-\ C$\textit{}} & $-\ C$\textit{} \\ \hline 
\textbf{T${}_{3}$} & $-\ C$\textit{} & \multicolumn{2}{|p{1.6in}|}{$-\ C$\textit{}} & $C\times (n+1)\times (1-w_2)$\textit{} & $-\ C$\textit{} & \textit{\dots } & \multicolumn{2}{|p{1.6in}|}{$-\ C$\textit{}} & $-\ C$\textit{} \\ \hline 
\textbf{\dots } & \textit{\dots } & \textit{\dots } & \textit{\dots } & \textit{\dots } & \textit{\dots } & \textit{} & \textit{\dots } & \textit{\dots } & \textit{\dots } \\ \hline 
\textbf{T${}_{n}$} & $-\ C$\textit{} & \multicolumn{2}{|p{1.6in}|}{$-\ C$\textit{}} & \multicolumn{2}{|p{1.6in}|}{$-\ C$\textit{}} & \textit{\dots } & $C\times (n+1)\times (1-w_{n-1})$\textit{} & $-\ C$\textit{} & $-\ C$\textit{} \\ \hline 
\textbf{T${}_{n+1}$} & $-\ C$\textit{} & $-\ C+[C\times (n+1)\times w_1]$\textit{} & $-\ C$\textit{} & $-\ C+[C\times (n+1)\times w_2]$\textit{} & $-\ C$\textit{} & \textit{\dots } & $-\ C+[C\times (n+1)\times w_{n-1}]$\textit{} & $-\ C$\textit{} & $C\times (n+1)$\textit{} \\ \hline 
\textbf{Capital at the end of the cycle} & $\left[C\times (n+1)\times \left(1+r\right)\right]+[C\times \left(n+1\right)\times \sum^n_{i=1}{{(1+rq}_n})]$\textit{} & $C\times (n+1)$\textit{} & $\left[C\times (n+1)\times \left(1+rp_1\right)\right]$\textit{} & $C\times (n+1)$\textit{} & $\left[C\times (n+1)\times \left(1+rp_2\right)\right]$\textit{} & \textit{\dots } & $C\times (n+1)$\textit{} & $\left[C\times n\times \left(1+rp_{n-1}\right)\right]$\textit{} & $\left[C\times (n+1)\times \left(1+rp_n\right)\right]$\textit{} \\ \hline 
\end{tabular}

Here is a screenshot of the Word table. enter image description here

  • 1
    Could you the LaTeX code produced by GrindEQ &c.? – Bernard Oct 17 '15 at 22:41
  • 1
    I've edited my original post, now it contains the code :-) @Bernard – Issam BOUSALAM Oct 17 '15 at 22:43
  • 1
    It doesn't seem possible to make such a table fit a standard portrait page. Would you consider printing it in landscape? Another solution would to swap rows and columns. A thirs solution might be to print the very long formula in the second column as a footnote at the bottom of the table. – Bernard Oct 17 '15 at 23:18
  • 2
    How can the best solution be to make your table illegible? If it doesn't matter whether people can read it, it shouldn't be included at all. If the information is needed, it has to be readable. Can't you print it in landscape but not as an appendix? – cfr Oct 18 '15 at 2:30
  • 4
    I'm voting to close this question because the OP found a solution to his problem in the comments. – TeXnician Dec 11 '17 at 15:44
2

The following solution uses

  • the rotating package and its sidewaystable environment to place the tabular material in landscape mode,

  • the tabularx package and its tabularx package to allow automatic line-wrapping in each of the 8 main data columns,

  • the ragged2e package and its \Centering macro to create a centered version of the X column type that allows hyphenation (if needed),

  • the booktabs package and its line-drawing macros (\toprule, \midrule, \bottomrule, \cmidrule and \addlinespace), along with a complete absence of any vertical rules, to give the table an "open" look, and

  • the xcolor and colortbl packages to render six of the cells in a soft gray.

With this setup, it's no longer necessary to crane one's neck repeatedly when moving from the upper to the lower portions of the table.

Observe that I've done away with all bold-facing -- it's simply not needed.

enter image description here

\documentclass{article}
\usepackage{amssymb,amsmath}
\usepackage[table,x11names]{xcolor}
\usepackage{rotating,tabularx,ragged2e,booktabs}
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}{>{\Centering\arraybackslash\hspace{0pt}}X}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably
\newcommand\abtimes{\allowbreak\times}
\begin{document}
\begin{sidewaystable}
\renewcommand{\tabularxcolumn}[1]{m{#1}} % center cell contents vertically
\setlength\tabcolsep{3pt}
\begin{tabularx}{\textwidth}{@{} P{0.8in} *{5}{C} c *{3}{C} @{} P{1sp} @{}}
\toprule
& Bank
& \multicolumn{2}{c}{Participant 1} & \multicolumn{2}{c}{Participant 2}
& $\cdots$
& \multicolumn{2}{c}{Participant $n-1$}  & Participant $n$ & \\
\cmidrule(lr){2-2} \cmidrule(lr){3-4} \cmidrule(lr){5-6}
\cmidrule(lr){8-9} \cmidrule(l){10-10}
& Investing option
& Take-up option & Investing option
& Take-up option & Investing option
& $\cdots$
& Take-up option & Investing option
& Investing option & \\
\midrule
$T_{1}$ & $C\abtimes (n+1)$
& \multicolumn{2}{c}{$-C$} & \multicolumn{2}{c}{$-C$} 
& $\cdots$
& \multicolumn{2}{c}{$-C$}  & $-C$ & \\ \addlinespace
$T_{2}$ & $-C$
& \cellcolor{Snow2} $C\abtimes(n+1)\abtimes(1-w_1)$
& \cellcolor{Snow2} $-C$
& \multicolumn{2}{c}{$-C$} & $\cdots$
& \multicolumn{2}{c}{$-C$} & $-C$ & \\ \addlinespace
$T_{3}$ & $-C$ & \multicolumn{2}{c}{$-C$} 
& \cellcolor{Snow2} $C\abtimes (n+1)\abtimes (1-w_2)$
& \cellcolor{Snow2} $-C$ & $\cdots$
& \multicolumn{2}{c}{$-C$}  & $-C$ \\
$\vdots$ & & & & & & $\vdots$ \\
$T_{n}$  & $-C$
& \multicolumn{2}{c}{$-C$}
& \multicolumn{2}{c}{$-C$}  & $\cdots$
& \cellcolor{Snow2} $C\abtimes (n+1)\abtimes (1-w_{n-1})$
& \cellcolor{Snow2} $-C$ & $-C$ & \\\addlinespace\addlinespace
$T_{n+1}$ & $-C$
& $-C+[C\times (n+1)\abtimes w_1]$ & $-C$
& $-C+[C\times (n+1)\abtimes w_2]$ & $-C$ & $\cdots$
& $-C+[C\times (n+1)\abtimes w_{n-1}]$ & $-C$
& $C\abtimes (n+1)$ & \\ \addlinespace\addlinespace
Capital at end of cycle
& $[C\abtimes (n+1)\abtimes (1+r)]+\allowbreak[C\times (n+1)\abtimes \sum^n_{i=1}(1+rq_n)]$
& $C\abtimes (n+1)$
& $C\abtimes (n+1)\abtimes (1+rp_1)$
& $C\abtimes (n+1)$ & $C\abtimes (n+1) \abtimes (1+rp_2)$
& $\cdots$
& $C\abtimes (n+1)$ & $C\abtimes (n+1) \abtimes (1+rp_{n-1})$
& $C\abtimes (n+1)\abtimes (1+rp_n)$ & \\
\bottomrule
\end{tabularx}
\end{sidewaystable}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.