TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using this LaTeX code to generate three tables side by side. However, it showing errors and not giving satisfactory result. Can anyone please help me to short out the problem.

\begin{table}
\centering
\makebox[0pt][c]{\parbox{1.2\textwidth}{%
\begin{minipage}[b]{0.265\hsize}\centering
\begin{tabular}{ | c | c |c | }
\multicolumn{3}{c}
\hline
{$q=1/10$} \\
\hline
T & $r_h$ & $\omega$ \\ 
\hline
0.233 & 0.135 & 2.38486-0.34667I  \\ 
0.256 & 0.140 & 2.38092-0.35837I \\
0.273 & 0.145 & 2.38049-0.35982I \\ 
0.278 & 0.146 & 2.38007-0.36130I \\ 
0.281 & 0.147 & 2.37964-0.36282I \\ 
\hline
0.284 & 0.761 & 2.54150-2.03209I \\
0.285 & 0.765 & 2.54515-2.04292I \\
0.289 & 0.800 & 2.57799-2.13761I \\
0.302 & 0.900 & 2.67987-2.40712I \\
0.312 & 1.000 & 2.79214-2.67552I \\
\hline
\end{tabular}
\end{minipage}
\hfill
\begin{minipage}[b]{0.265\hsize}\centering
\begin{tabular}{ | c | c | c | }
\multicolumn{3}{c}
\hline
{$q=1/9$} \\
\hline
T & $r_h$ & $\omega$ \\
\hline
0.227 & 0.150 & 2.34385-0.41094I  \\ 
0.245 & 0.155 & 2.34215-0.41723I \\
0.260 & 0.160 & 2.34056-0.42416I \\ 
0.271 & 0.165 & 2.33908-0.43175I \\ 
0.276 & 0.167 & 2.33852-0.43497I \\ 
\hline
0.280 & 0.720 & 2.50248-1.92299I \\
0.283 & 0.750 & 2.52893-2.00424I \\
0.286 & 0.780 & 2.55660-2.08533I \\
0.289 & 0.800 & 2.57568-2.13931I \\
0.302 & 0.900 & 2.67807-2.40842I \\
\hline
\end{tabular}
\end{minipage}
\hfill
\begin{minipage}[b]{0.265\hsize}\centering
\begin{tabular}{ | c | c | c |}
\multicolumn{3}{c}
\hline
{$q=1/8$} \\
\hline
T & $r_h$ & $\omega$ \\ 
\hline
0.246 & 0.180 & 2.29733-0.50611I  \\ 
0.255 & 0.185 & 2.29654-0.51364I \\
0.263 & 0.190 & 2.29589-0.52172I \\ 
0.269 & 0.195 & 2.29534-0.53033I \\ 
0.273 & 0.199 & 2.29496-0.53758I \\ 
\hline
0.275 & 0.675 & 2.46067-1.80426I \\
0.277 & 0.700 & 2.48131-1.87194I \\
0.288 & 0.800 & 2.57245-2.14170I \\
0.302 & 0.900 & 2.67555-2.41027I \\
0.317 & 1.000 & 2.78870-2.67796I \\
\hline
\end{tabular}
\end{minipage}%
}}
\end{table}
share|improve this question
up vote 5 down vote accepted

The problem is that a \hline command within the argument of \multicolumn as in \multicolumn{3}{c}\hline{$q=1/10$} do not work. Just remove that \hline in each table and it should work.

On the other hand, consider remove the superfluous onion layers (\makebox, \parbox, and minipages) leaving this simple structure, that should work also:

\begin{tabular} ... \end{tabular} \hfill
\begin{tabular} ... \end{tabular} \hfill
\begin{tabular} ... \end{tabular}

If that do not fit in the page, is time to decrease the font size, or time of use a landscape page, may be with other margins, or re-design the table (Is it really useful to show 5 digits in a number near 2?) but not of exceed the margins. On the other hand ...please, please, avoid vertical lines and use the booktabs package to have better horizontal lines and vertical spacing. For example:

mwe

\documentclass{article}
\usepackage[margin=1in,a4paper]{geometry}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\footnotesize
\begin{tabular}{ccc}
\multicolumn{3}{c}
{$q=1/10$} \\
\toprule
T & $r_h$ & $\omega$ \\ 
\midrule
0.233 & 0.135 & 2.38486-0.34667I  \\ 
0.256 & 0.140 & 2.38092-0.35837I \\
0.273 & 0.145 & 2.38049-0.35982I \\ 
0.278 & 0.146 & 2.38007-0.36130I \\ 
0.281 & 0.147 & 2.37964-0.36282I \\ 
\midrule
0.284 & 0.761 & 2.54150-2.03209I \\
0.285 & 0.765 & 2.54515-2.04292I \\
0.289 & 0.800 & 2.57799-2.13761I \\
0.302 & 0.900 & 2.67987-2.40712I \\
0.312 & 1.000 & 2.79214-2.67552I \\
\bottomrule
\end{tabular}
\hfill
\begin{tabular}{ccc}
\multicolumn{3}{c}
{$q=1/9$} \\
\toprule
T & $r_h$ & $\omega$ \\
\midrule
0.227 & 0.150 & 2.34385-0.41094I  \\ 
0.245 & 0.155 & 2.34215-0.41723I \\
0.260 & 0.160 & 2.34056-0.42416I \\ 
0.271 & 0.165 & 2.33908-0.43175I \\ 
0.276 & 0.167 & 2.33852-0.43497I \\ 
\midrule
0.280 & 0.720 & 2.50248-1.92299I \\
0.283 & 0.750 & 2.52893-2.00424I \\
0.286 & 0.780 & 2.55660-2.08533I \\
0.289 & 0.800 & 2.57568-2.13931I \\
0.302 & 0.900 & 2.67807-2.40842I \\
\bottomrule
\end{tabular}
\hfill
\begin{tabular}{ccc}
\multicolumn{3}{c}
{$q=1/8$} \\
\toprule
T & $r_h$ & $\omega$ \\ 
\midrule
0.246 & 0.180 & 2.29733-0.50611I  \\ 
0.255 & 0.185 & 2.29654-0.51364I \\
0.263 & 0.190 & 2.29589-0.52172I \\ 
0.269 & 0.195 & 2.29534-0.53033I \\ 
0.273 & 0.199 & 2.29496-0.53758I \\ 
\midrule
0.275 & 0.675 & 2.46067-1.80426I \\
0.277 & 0.700 & 2.48131-1.87194I \\
0.288 & 0.800 & 2.57245-2.14170I \\
0.302 & 0.900 & 2.67555-2.41027I \\
0.317 & 1.000 & 2.78870-2.67796I \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
share|improve this answer
    
@Fran....Thank you very much for your help. Appreciated. – chandra Jan 30 at 7:37

Some suggestions:

  • No need for the \makebox, \parbox and minipage wrappers. Just provide three tabular environments, separated by \hfill.

  • Actually, since all of the material in the tables is math-y, it's better to use array environments instead of tabular environments. For instance, you'll get typographic "minus" signs instead of typographic "dash" signs in the third column of each table.

  • Try to go for an "open" look by (a) getting rid of all vertical lines and (b) using the line-drawing macros of the booktabs package instead of \hline.

  • By reducing the values of \arraycolsep (the parameter that governs the amount of intercolumn whitespace) and \medmuskip (the parameter that governs the whitespace around the "minus" signs), you needn't reduce the font size in order to make the three tables fit side by side.

(The horizontal line at the top of the following screenshot is there just to illustrate the width of the text block.)

enter image description here

\documentclass{article}
\usepackage[margin=2.5cm,a4paper]{geometry} % set page parameters
\usepackage{booktabs}
\begin{document}

\hrule % just to illustrate width of text block

\begin{table}[h!]
\setlength\arraycolsep{4pt} % default: 5pt
\medmuskip=3mu              % default: 4mu
$ % start math mode
\begin{array}{@{} ccc  @{}}
\multicolumn{3}{c}{q=1/10}\\
\toprule
T & r_h & \omega \\ 
\midrule
0.233 & 0.135 & 2.38486-0.34667I  \\ 
0.256 & 0.140 & 2.38092-0.35837I \\
0.273 & 0.145 & 2.38049-0.35982I \\ 
0.278 & 0.146 & 2.38007-0.36130I \\ 
0.281 & 0.147 & 2.37964-0.36282I \\ 
\addlinespace
0.284 & 0.761 & 2.54150-2.03209I \\
0.285 & 0.765 & 2.54515-2.04292I \\
0.289 & 0.800 & 2.57799-2.13761I \\
0.302 & 0.900 & 2.67987-2.40712I \\
0.312 & 1.000 & 2.79214-2.67552I \\
\bottomrule
\end{array}
\hfill
\begin{array}{@{} ccc @{}}
\multicolumn{3}{c}{q=1/9}\\
\toprule
T & r_h & \omega \\
\midrule
0.227 & 0.150 & 2.34385-0.41094I  \\ 
0.245 & 0.155 & 2.34215-0.41723I \\
0.260 & 0.160 & 2.34056-0.42416I \\ 
0.271 & 0.165 & 2.33908-0.43175I \\ 
0.276 & 0.167 & 2.33852-0.43497I \\ 
\addlinespace
0.280 & 0.720 & 2.50248-1.92299I \\
0.283 & 0.750 & 2.52893-2.00424I \\
0.286 & 0.780 & 2.55660-2.08533I \\
0.289 & 0.800 & 2.57568-2.13931I \\
0.302 & 0.900 & 2.67807-2.40842I \\
\bottomrule
\end{array}
\hfill
\begin{array}{@{} ccc @{}}
\multicolumn{3}{c}{q=1/8}\\
\toprule
T & r_h & \omega \\ 
\midrule
0.246 & 0.180 & 2.29733-0.50611I  \\ 
0.255 & 0.185 & 2.29654-0.51364I \\
0.263 & 0.190 & 2.29589-0.52172I \\ 
0.269 & 0.195 & 2.29534-0.53033I \\ 
0.273 & 0.199 & 2.29496-0.53758I \\ 
\addlinespace
0.275 & 0.675 & 2.46067-1.80426I \\
0.277 & 0.700 & 2.48131-1.87194I \\
0.288 & 0.800 & 2.57245-2.14170I \\
0.302 & 0.900 & 2.67555-2.41027I \\
0.317 & 1.000 & 2.78870-2.67796I \\
\bottomrule
\end{array}
$ % end math mode
\end{table}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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