Adding an extra column to an existing table

I have found very nice ways to change the order of the columns of a table.

But is there any simple solution to add new columns to an existing table? I have columns from a table that I want want insert into another table (with the same number of rows).

This is the table I have:

\begin{table}[ht]
\centering
\begin{tabular}{rlrrrrr}
\hline
& Country & y & nx & c & x & g \\
\hline
1 & Australia & 1.32 & 2.68 & 0.83 & 2.98 & 1.27 \\
2 & Austria & 1.24 & 2.55 & 0.94 & 2.65 & 0.68 \\
3 & Canada & 1.36 & 2.79 & 0.81 & 2.93 & 1.04 \\
4 & European Union (15 countries) & 1.07 & 2.84 & 0.72 & 2.44 & 0.53 \\
5 & France & 1.12 & 2.44 & 0.79 & 2.30 & 0.58 \\
6 & Germany & 1.58 & 1.02 & 0.77 & 2.57 & 0.86 \\
7 & Italy & 1.46 & 1.13 & 0.87 & 2.55 & 0.58 \\
8 & Japan & 1.56 & 1.79 & 0.79 & 2.22 & 0.74 \\
9 & Switzerland & 1.66 & 1.63 & 0.64 & 2.36 & 0.92 \\
10 & United Kingdom & 1.48 & 1.50 & 1.08 & 2.58 & 0.84 \\
11 & United States & 1.63 & 1.63 & 0.77 & 2.48 & 0.85 \\
\hline
\end{tabular}
\end{table}

• thanks, Heiko. That stupid the question? =P – D Pinto Aug 22 '15 at 10:33
• It depends on the kind of table, the TeX markup, which is used, ... There are data tables (pgfplotstable, ...), TeX tables (\halign), LaTeX tables (tabular, ...), ... – Heiko Oberdiek Aug 22 '15 at 10:33
• Are the two tables (one with several columns, and one with just one column) already set up as tabular (or similar) environments? – Mico Aug 22 '15 at 10:35
• I would say the question is not yet complete, the context is missing. A MWE can help to clarify the question, for example. – Heiko Oberdiek Aug 22 '15 at 10:35
• I think, aligning the data in the source and using an editor, which supports copying of rectangular areas, or just filling the data by hand is the fastest approach. Another option is to maintain the data in spreadheet like programs and export/compose the tables from there. Writing macros to manipulate the tabulars is not quiet effective and costs too much time. Another way, not too elegant, is to crop the second table and put the tables as images side by side to add the column, if the row heights of the two tables are matching exactly. – Heiko Oberdiek Aug 22 '15 at 10:44

If the two tabular environments have the exact same (vertical) format, all you need to do is to write one environment immediately after the other, making sure there's no space between the two. The "no space" requirement is achieved by terminating the first tabular environment with a % (comment) character.

\documentclass{article}
\begin{document}

\begin{table}[ht]
\centering
\begin{tabular}{rlrrrrr}
\hline
& Country & y & nx & c & x & g \\
\hline
1 & Australia & 1.32 & 2.68 & 0.83 & 2.98 & 1.27 \\
2 & Austria & 1.24 & 2.55 & 0.94 & 2.65 & 0.68 \\
3 & Canada & 1.36 & 2.79 & 0.81 & 2.93 & 1.04 \\
4 & EU (15 countries) & 1.07 & 2.84 & 0.72 & 2.44 & 0.53 \\
5 & France & 1.12 & 2.44 & 0.79 & 2.30 & 0.58 \\
6 & Germany & 1.58 & 1.02 & 0.77 & 2.57 & 0.86 \\
7 & Italy & 1.46 & 1.13 & 0.87 & 2.55 & 0.58 \\
8 & Japan & 1.56 & 1.79 & 0.79 & 2.22 & 0.74 \\
9 & Switzerland & 1.66 & 1.63 & 0.64 & 2.36 & 0.92 \\
10 & United Kingdom & 1.48 & 1.50 & 1.08 & 2.58 & 0.84 \\
11 & United States & 1.63 & 1.63 & 0.77 & 2.48 & 0.85 \\
\hline
\end{tabular}%  <-- note the "%" symbol
\begin{tabular}{r}
\hline
abc\\
\hline
0.01 \\ 0.02 \\ 0.03 \\ 0.04 \\ 0.05 \\ 0.06 \\
0.07 \\ 0.08 \\ 0.09 \\ 0.10 \\ 0.11 \\
\hline
\end{tabular}
\end{table}

\end{document}

• Your solution is (counting the characters needed) about fifty times easier than mine. :-) – Przemysław Scherwentke Aug 22 '15 at 13:37
• @PrzemysławScherwentke - Thanks! I'd say your answer doesn't require the precise deployment of the % character, and is thus a bit more forgiving. :-) – Mico Aug 22 '15 at 13:39

If we add at the end, with the same height, we can put tabular inside tabular (@{} are for removing an extra horizontal space):

\documentclass{article}

\begin{document}

\begin{table}[ht]
\centering
\begin{tabular}{@{}l@{}l@{}} %here
\begin{tabular}{rlrrrrr}
\hline
& Country & y & nx & c & x & g \\
\hline
1 & Australia & 1.32 & 2.68 & 0.83 & 2.98 & 1.27 \\
2 & Austria & 1.24 & 2.55 & 0.94 & 2.65 & 0.68 \\
3 & Canada & 1.36 & 2.79 & 0.81 & 2.93 & 1.04 \\
4 & European Union (15 countries) & 1.07 & 2.84 & 0.72 & 2.44 & 0.53 \\
5 & France & 1.12 & 2.44 & 0.79 & 2.30 & 0.58 \\
6 & Germany & 1.58 & 1.02 & 0.77 & 2.57 & 0.86 \\
7 & Italy & 1.46 & 1.13 & 0.87 & 2.55 & 0.58 \\
8 & Japan & 1.56 & 1.79 & 0.79 & 2.22 & 0.74 \\
9 & Switzerland & 1.66 & 1.63 & 0.64 & 2.36 & 0.92 \\
10 & United Kingdom & 1.48 & 1.50 & 1.08 & 2.58 & 0.84 \\
11 & United States & 1.63 & 1.63 & 0.77 & 2.48 & 0.85 \\
\hline
\end{tabular}
& %here
\begin{tabular}{rlrrrrr}
\hline
& Country & y & nx & c & x & g \\
\hline
1 & Australia & 1.32 & 2.68 & 0.83 & 2.98 & 1.27 \\
2 & Austria & 1.24 & 2.55 & 0.94 & 2.65 & 0.68 \\
3 & Canada & 1.36 & 2.79 & 0.81 & 2.93 & 1.04 \\
4 & European Union (15 countries) & 1.07 & 2.84 & 0.72 & 2.44 & 0.53 \\
5 & France & 1.12 & 2.44 & 0.79 & 2.30 & 0.58 \\
6 & Germany & 1.58 & 1.02 & 0.77 & 2.57 & 0.86 \\
7 & Italy & 1.46 & 1.13 & 0.87 & 2.55 & 0.58 \\
8 & Japan & 1.56 & 1.79 & 0.79 & 2.22 & 0.74 \\
9 & Switzerland & 1.66 & 1.63 & 0.64 & 2.36 & 0.92 \\
10 & United Kingdom & 1.48 & 1.50 & 1.08 & 2.58 & 0.84 \\
11 & United States & 1.63 & 1.63 & 0.77 & 2.48 & 0.85 \\
\hline
\end{tabular}
\end{tabular} %here
\end{table}

\end{document}


In the picture there is a bit modified, rotated version: